OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 #include <stdio.h> | 10 #include <stdio.h> |
11 | 11 |
12 #include <deque> | 12 #include <deque> |
13 #include <map> | 13 #include <map> |
14 | 14 |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 | 16 |
17 #include "webrtc/base/scoped_ptr.h" | 17 #include "webrtc/base/scoped_ptr.h" |
18 #include "webrtc/base/thread_annotations.h" | 18 #include "webrtc/base/thread_annotations.h" |
19 #include "webrtc/call.h" | 19 #include "webrtc/call.h" |
20 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 20 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
21 #include "webrtc/frame_callback.h" | |
21 #include "webrtc/modules/rtp_rtcp/interface/rtp_header_parser.h" | 22 #include "webrtc/modules/rtp_rtcp/interface/rtp_header_parser.h" |
22 #include "webrtc/system_wrappers/interface/clock.h" | 23 #include "webrtc/system_wrappers/interface/clock.h" |
23 #include "webrtc/system_wrappers/interface/cpu_info.h" | 24 #include "webrtc/system_wrappers/interface/cpu_info.h" |
24 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" | 25 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" |
25 #include "webrtc/system_wrappers/interface/event_wrapper.h" | 26 #include "webrtc/system_wrappers/interface/event_wrapper.h" |
26 #include "webrtc/system_wrappers/interface/sleep.h" | 27 #include "webrtc/system_wrappers/interface/sleep.h" |
27 #include "webrtc/test/call_test.h" | 28 #include "webrtc/test/call_test.h" |
28 #include "webrtc/test/direct_transport.h" | 29 #include "webrtc/test/direct_transport.h" |
29 #include "webrtc/test/encoder_settings.h" | 30 #include "webrtc/test/encoder_settings.h" |
30 #include "webrtc/test/fake_encoder.h" | 31 #include "webrtc/test/fake_encoder.h" |
31 #include "webrtc/test/frame_generator.h" | 32 #include "webrtc/test/frame_generator.h" |
32 #include "webrtc/test/frame_generator_capturer.h" | 33 #include "webrtc/test/frame_generator_capturer.h" |
33 #include "webrtc/test/statistics.h" | 34 #include "webrtc/test/statistics.h" |
34 #include "webrtc/test/testsupport/fileutils.h" | 35 #include "webrtc/test/testsupport/fileutils.h" |
35 #include "webrtc/typedefs.h" | 36 #include "webrtc/typedefs.h" |
36 | 37 |
37 namespace webrtc { | 38 namespace webrtc { |
38 | 39 |
39 static const int kFullStackTestDurationSecs = 60; | 40 static const int kFullStackTestDurationSecs = 60; |
41 static const int kSendStatsPollingIntervalMs = 1000; | |
40 | 42 |
41 struct FullStackTestParams { | 43 struct FullStackTestParams { |
42 const char* test_label; | 44 const char* test_label; |
43 struct { | 45 struct { |
44 const char* name; | 46 const char* name; |
45 size_t width, height; | 47 size_t width, height; |
46 int fps; | 48 int fps; |
47 } clip; | 49 } clip; |
48 bool screenshare; | 50 bool screenshare; |
49 int min_bitrate_bps; | 51 int min_bitrate_bps; |
50 int target_bitrate_bps; | 52 int target_bitrate_bps; |
51 int max_bitrate_bps; | 53 int max_bitrate_bps; |
52 double avg_psnr_threshold; | 54 double avg_psnr_threshold; |
53 double avg_ssim_threshold; | 55 double avg_ssim_threshold; |
54 int test_durations_secs; | 56 int test_durations_secs; |
55 FakeNetworkPipe::Config link; | 57 FakeNetworkPipe::Config link; |
56 }; | 58 }; |
57 | 59 |
58 class FullStackTest : public test::CallTest { | 60 class FullStackTest : public test::CallTest { |
59 protected: | 61 protected: |
60 void RunTest(const FullStackTestParams& params); | 62 void RunTest(const FullStackTestParams& params); |
61 }; | 63 }; |
62 | 64 |
63 class VideoAnalyzer : public PacketReceiver, | 65 class VideoAnalyzer : public PacketReceiver, |
64 public newapi::Transport, | 66 public newapi::Transport, |
65 public VideoRenderer, | 67 public VideoRenderer, |
66 public VideoCaptureInput { | 68 public VideoCaptureInput, |
69 public EncodedFrameObserver { | |
67 public: | 70 public: |
68 VideoAnalyzer(VideoCaptureInput* input, | 71 VideoAnalyzer(VideoCaptureInput* input, |
69 Transport* transport, | 72 Transport* transport, |
70 const char* test_label, | 73 const char* test_label, |
71 double avg_psnr_threshold, | 74 double avg_psnr_threshold, |
72 double avg_ssim_threshold, | 75 double avg_ssim_threshold, |
73 int duration_frames) | 76 int duration_frames) |
74 : input_(input), | 77 : input_(input), |
75 transport_(transport), | 78 transport_(transport), |
76 receiver_(nullptr), | 79 receiver_(nullptr), |
80 send_stream_(nullptr), | |
77 test_label_(test_label), | 81 test_label_(test_label), |
78 frames_to_process_(duration_frames), | 82 frames_to_process_(duration_frames), |
79 frames_recorded_(0), | 83 frames_recorded_(0), |
80 frames_processed_(0), | 84 frames_processed_(0), |
81 dropped_frames_(0), | 85 dropped_frames_(0), |
82 last_render_time_(0), | 86 last_render_time_(0), |
83 rtp_timestamp_delta_(0), | 87 rtp_timestamp_delta_(0), |
84 avg_psnr_threshold_(avg_psnr_threshold), | 88 avg_psnr_threshold_(avg_psnr_threshold), |
85 avg_ssim_threshold_(avg_ssim_threshold), | 89 avg_ssim_threshold_(avg_ssim_threshold), |
86 comparison_available_event_(EventWrapper::Create()), | 90 comparison_available_event_(EventWrapper::Create()), |
(...skipping 16 matching lines...) Expand all Loading... | |
103 num_cores -= kMinCoresLeft; | 107 num_cores -= kMinCoresLeft; |
104 num_cores = std::min(num_cores, kMaxComparisonThreads); | 108 num_cores = std::min(num_cores, kMaxComparisonThreads); |
105 } | 109 } |
106 | 110 |
107 for (uint32_t i = 0; i < num_cores; ++i) { | 111 for (uint32_t i = 0; i < num_cores; ++i) { |
108 rtc::scoped_ptr<ThreadWrapper> thread = | 112 rtc::scoped_ptr<ThreadWrapper> thread = |
109 ThreadWrapper::CreateThread(&FrameComparisonThread, this, "Analyzer"); | 113 ThreadWrapper::CreateThread(&FrameComparisonThread, this, "Analyzer"); |
110 EXPECT_TRUE(thread->Start()); | 114 EXPECT_TRUE(thread->Start()); |
111 comparison_thread_pool_.push_back(thread.release()); | 115 comparison_thread_pool_.push_back(thread.release()); |
112 } | 116 } |
117 | |
118 stats_polling_thread_ = | |
119 ThreadWrapper::CreateThread(&PollStatsThread, this, "StatsPoller"); | |
120 EXPECT_TRUE(stats_polling_thread_->Start()); | |
113 } | 121 } |
114 | 122 |
115 ~VideoAnalyzer() { | 123 ~VideoAnalyzer() { |
116 for (ThreadWrapper* thread : comparison_thread_pool_) { | 124 for (ThreadWrapper* thread : comparison_thread_pool_) { |
117 EXPECT_TRUE(thread->Stop()); | 125 EXPECT_TRUE(thread->Stop()); |
118 delete thread; | 126 delete thread; |
119 } | 127 } |
128 EXPECT_TRUE(stats_polling_thread_->Stop()); | |
120 } | 129 } |
121 | 130 |
122 virtual void SetReceiver(PacketReceiver* receiver) { receiver_ = receiver; } | 131 virtual void SetReceiver(PacketReceiver* receiver) { receiver_ = receiver; } |
123 | 132 |
124 DeliveryStatus DeliverPacket(MediaType media_type, const uint8_t* packet, | 133 DeliveryStatus DeliverPacket(MediaType media_type, const uint8_t* packet, |
125 size_t length) override { | 134 size_t length) override { |
126 rtc::scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create()); | 135 rtc::scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create()); |
127 RTPHeader header; | 136 RTPHeader header; |
128 parser->Parse(packet, length, &header); | 137 parser->Parse(packet, length, &header); |
129 { | 138 { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
166 Clock::GetRealTimeClock()->CurrentNtpInMilliseconds(); | 175 Clock::GetRealTimeClock()->CurrentNtpInMilliseconds(); |
167 } | 176 } |
168 | 177 |
169 return transport_->SendRtp(packet, length); | 178 return transport_->SendRtp(packet, length); |
170 } | 179 } |
171 | 180 |
172 bool SendRtcp(const uint8_t* packet, size_t length) override { | 181 bool SendRtcp(const uint8_t* packet, size_t length) override { |
173 return transport_->SendRtcp(packet, length); | 182 return transport_->SendRtcp(packet, length); |
174 } | 183 } |
175 | 184 |
185 void EncodedFrameCallback(const EncodedFrame& frame) override { | |
186 rtc::CritScope lock(&comparison_lock_); | |
187 if (frames_recorded_ < frames_to_process_) | |
188 encoded_frame_size_.AddSample(frame.length_); | |
189 } | |
190 | |
176 void RenderFrame(const VideoFrame& video_frame, | 191 void RenderFrame(const VideoFrame& video_frame, |
177 int time_to_render_ms) override { | 192 int time_to_render_ms) override { |
178 int64_t render_time_ms = | 193 int64_t render_time_ms = |
179 Clock::GetRealTimeClock()->CurrentNtpInMilliseconds(); | 194 Clock::GetRealTimeClock()->CurrentNtpInMilliseconds(); |
180 uint32_t send_timestamp = video_frame.timestamp() - rtp_timestamp_delta_; | 195 uint32_t send_timestamp = video_frame.timestamp() - rtp_timestamp_delta_; |
181 | 196 |
182 rtc::CritScope lock(&crit_); | 197 rtc::CritScope lock(&crit_); |
183 | 198 |
184 while (frames_.front().timestamp() < send_timestamp) { | 199 while (frames_.front().timestamp() < send_timestamp) { |
185 AddFrameComparison(frames_.front(), last_rendered_frame_, true, | 200 AddFrameComparison(frames_.front(), last_rendered_frame_, true, |
(...skipping 29 matching lines...) Expand all Loading... | |
215 frames_processed = frames_processed_; | 230 frames_processed = frames_processed_; |
216 } | 231 } |
217 if (last_frames_processed == -1) { | 232 if (last_frames_processed == -1) { |
218 last_frames_processed = frames_processed; | 233 last_frames_processed = frames_processed; |
219 continue; | 234 continue; |
220 } | 235 } |
221 ASSERT_GT(frames_processed, last_frames_processed) | 236 ASSERT_GT(frames_processed, last_frames_processed) |
222 << "Analyzer stalled while waiting for test to finish."; | 237 << "Analyzer stalled while waiting for test to finish."; |
223 last_frames_processed = frames_processed; | 238 last_frames_processed = frames_processed; |
224 } | 239 } |
240 | |
241 done_->Set(); // Signal stats polling thread if that is still waiting. | |
225 } | 242 } |
226 | 243 |
227 VideoCaptureInput* input_; | 244 VideoCaptureInput* input_; |
228 Transport* transport_; | 245 Transport* transport_; |
229 PacketReceiver* receiver_; | 246 PacketReceiver* receiver_; |
247 VideoSendStream* send_stream_; | |
230 | 248 |
231 private: | 249 private: |
232 struct FrameComparison { | 250 struct FrameComparison { |
233 FrameComparison() | 251 FrameComparison() |
234 : dropped(false), send_time_ms(0), recv_time_ms(0), render_time_ms(0) {} | 252 : dropped(false), send_time_ms(0), recv_time_ms(0), render_time_ms(0) {} |
235 | 253 |
236 FrameComparison(const VideoFrame& reference, | 254 FrameComparison(const VideoFrame& reference, |
237 const VideoFrame& render, | 255 const VideoFrame& render, |
238 bool dropped, | 256 bool dropped, |
239 int64_t send_time_ms, | 257 int64_t send_time_ms, |
(...skipping 18 matching lines...) Expand all Loading... | |
258 const VideoFrame& render, | 276 const VideoFrame& render, |
259 bool dropped, | 277 bool dropped, |
260 int64_t render_time_ms) | 278 int64_t render_time_ms) |
261 EXCLUSIVE_LOCKS_REQUIRED(crit_) { | 279 EXCLUSIVE_LOCKS_REQUIRED(crit_) { |
262 int64_t send_time_ms = send_times_[reference.timestamp()]; | 280 int64_t send_time_ms = send_times_[reference.timestamp()]; |
263 send_times_.erase(reference.timestamp()); | 281 send_times_.erase(reference.timestamp()); |
264 int64_t recv_time_ms = recv_times_[reference.timestamp()]; | 282 int64_t recv_time_ms = recv_times_[reference.timestamp()]; |
265 recv_times_.erase(reference.timestamp()); | 283 recv_times_.erase(reference.timestamp()); |
266 | 284 |
267 rtc::CritScope crit(&comparison_lock_); | 285 rtc::CritScope crit(&comparison_lock_); |
268 comparisons_.push_back(FrameComparison(reference, | 286 comparisons_.push_back(FrameComparison(reference, render, dropped, |
269 render, | 287 send_time_ms, recv_time_ms, |
270 dropped, | |
271 send_time_ms, | |
272 recv_time_ms, | |
273 render_time_ms)); | 288 render_time_ms)); |
274 comparison_available_event_->Set(); | 289 comparison_available_event_->Set(); |
275 } | 290 } |
276 | 291 |
292 static bool PollStatsThread(void* obj) { | |
293 return static_cast<VideoAnalyzer*>(obj)->PollStats(); | |
294 } | |
295 | |
296 bool PollStats() { | |
297 switch (done_->Wait(kSendStatsPollingIntervalMs)) { | |
298 case kEventSignaled: | |
299 case kEventError: | |
300 done_->Set(); // Make sure main thread is also signaled. | |
301 return false; | |
302 case kEventTimeout: | |
303 break; | |
304 default: | |
pbos-webrtc
2015/07/21 20:47:49
Do you need default: here? (Is this an enum?)
sprang_webrtc
2015/07/22 12:12:10
It's an enum. I'd like to get a compile-time error
| |
305 RTC_NOTREACHED(); | |
306 } | |
307 | |
308 VideoSendStream::Stats stats = send_stream_->GetStats(); | |
309 | |
310 rtc::CritScope crit(&comparison_lock_); | |
311 if (frames_recorded_ >= frames_to_process_) | |
pbos-webrtc
2015/07/21 20:47:49
Does this mean that we're done? If so add a commen
sprang_webrtc
2015/07/22 12:12:10
Done.
| |
312 return false; | |
313 encode_frame_rate_.AddSample(stats.encode_frame_rate); | |
314 avg_encode_time_ms.AddSample(stats.avg_encode_time_ms); | |
315 encode_usage_percent.AddSample(stats.encode_usage_percent); | |
316 media_bitrate_bps.AddSample(stats.media_bitrate_bps); | |
317 | |
318 return true; | |
319 } | |
320 | |
277 static bool FrameComparisonThread(void* obj) { | 321 static bool FrameComparisonThread(void* obj) { |
278 return static_cast<VideoAnalyzer*>(obj)->CompareFrames(); | 322 return static_cast<VideoAnalyzer*>(obj)->CompareFrames(); |
279 } | 323 } |
280 | 324 |
281 bool CompareFrames() { | 325 bool CompareFrames() { |
282 if (AllFramesRecorded()) | 326 if (AllFramesRecorded()) |
283 return false; | 327 return false; |
284 | 328 |
285 VideoFrame reference; | 329 VideoFrame reference; |
286 VideoFrame render; | 330 VideoFrame render; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
351 void PrintResults() { | 395 void PrintResults() { |
352 rtc::CritScope crit(&comparison_lock_); | 396 rtc::CritScope crit(&comparison_lock_); |
353 PrintResult("psnr", psnr_, " dB"); | 397 PrintResult("psnr", psnr_, " dB"); |
354 PrintResult("ssim", ssim_, ""); | 398 PrintResult("ssim", ssim_, ""); |
355 PrintResult("sender_time", sender_time_, " ms"); | 399 PrintResult("sender_time", sender_time_, " ms"); |
356 printf("RESULT dropped_frames: %s = %d frames\n", test_label_, | 400 printf("RESULT dropped_frames: %s = %d frames\n", test_label_, |
357 dropped_frames_); | 401 dropped_frames_); |
358 PrintResult("receiver_time", receiver_time_, " ms"); | 402 PrintResult("receiver_time", receiver_time_, " ms"); |
359 PrintResult("total_delay_incl_network", end_to_end_, " ms"); | 403 PrintResult("total_delay_incl_network", end_to_end_, " ms"); |
360 PrintResult("time_between_rendered_frames", rendered_delta_, " ms"); | 404 PrintResult("time_between_rendered_frames", rendered_delta_, " ms"); |
405 PrintResult("encoded_frame_size", encoded_frame_size_, " bytes"); | |
406 PrintResult("encode_frame_rate_", encode_frame_rate_, " fps"); | |
pbos-webrtc
2015/07/21 20:47:49
encode_frame_rate (drop the _ suffix)
sprang_webrtc
2015/07/22 12:12:10
Done.
| |
407 PrintResult("avg_encode_time", avg_encode_time_ms, " ms"); | |
pbos-webrtc
2015/07/21 20:47:49
Should this be called avg_ ? All of these are aver
sprang_webrtc
2015/07/22 12:12:10
I'll drop the avg. Just copied the name from the s
| |
408 PrintResult("encode_usage_percent", encode_usage_percent, " percent"); | |
409 PrintResult("media_bitrate", media_bitrate_bps, " bps"); | |
410 | |
361 EXPECT_GT(psnr_.Mean(), avg_psnr_threshold_); | 411 EXPECT_GT(psnr_.Mean(), avg_psnr_threshold_); |
362 EXPECT_GT(ssim_.Mean(), avg_ssim_threshold_); | 412 EXPECT_GT(ssim_.Mean(), avg_ssim_threshold_); |
363 } | 413 } |
364 | 414 |
365 void PerformFrameComparison(const FrameComparison& comparison) { | 415 void PerformFrameComparison(const FrameComparison& comparison) { |
366 // Perform expensive psnr and ssim calculations while not holding lock. | 416 // Perform expensive psnr and ssim calculations while not holding lock. |
367 double psnr = I420PSNR(&comparison.reference, &comparison.render); | 417 double psnr = I420PSNR(&comparison.reference, &comparison.render); |
368 double ssim = I420SSIM(&comparison.reference, &comparison.render); | 418 double ssim = I420SSIM(&comparison.reference, &comparison.render); |
369 | 419 |
370 rtc::CritScope crit(&comparison_lock_); | 420 rtc::CritScope crit(&comparison_lock_); |
(...skipping 19 matching lines...) Expand all Loading... | |
390 const char* unit) { | 440 const char* unit) { |
391 printf("RESULT %s: %s = {%f, %f}%s\n", | 441 printf("RESULT %s: %s = {%f, %f}%s\n", |
392 result_type, | 442 result_type, |
393 test_label_, | 443 test_label_, |
394 stats.Mean(), | 444 stats.Mean(), |
395 stats.StandardDeviation(), | 445 stats.StandardDeviation(), |
396 unit); | 446 unit); |
397 } | 447 } |
398 | 448 |
399 const char* const test_label_; | 449 const char* const test_label_; |
400 test::Statistics sender_time_; | 450 test::Statistics sender_time_ GUARDED_BY(comparison_lock_); |
401 test::Statistics receiver_time_; | 451 test::Statistics receiver_time_ GUARDED_BY(comparison_lock_); |
402 test::Statistics psnr_; | 452 test::Statistics psnr_ GUARDED_BY(comparison_lock_); |
403 test::Statistics ssim_; | 453 test::Statistics ssim_ GUARDED_BY(comparison_lock_); |
404 test::Statistics end_to_end_; | 454 test::Statistics end_to_end_ GUARDED_BY(comparison_lock_); |
405 test::Statistics rendered_delta_; | 455 test::Statistics rendered_delta_ GUARDED_BY(comparison_lock_); |
456 test::Statistics encoded_frame_size_ GUARDED_BY(comparison_lock_); | |
457 test::Statistics encode_frame_rate_ GUARDED_BY(comparison_lock_); | |
458 test::Statistics avg_encode_time_ms GUARDED_BY(comparison_lock_); | |
459 test::Statistics encode_usage_percent GUARDED_BY(comparison_lock_); | |
460 test::Statistics media_bitrate_bps GUARDED_BY(comparison_lock_); | |
461 | |
406 const int frames_to_process_; | 462 const int frames_to_process_; |
407 int frames_recorded_; | 463 int frames_recorded_; |
408 int frames_processed_; | 464 int frames_processed_; |
409 int dropped_frames_; | 465 int dropped_frames_; |
410 int64_t last_render_time_; | 466 int64_t last_render_time_; |
411 uint32_t rtp_timestamp_delta_; | 467 uint32_t rtp_timestamp_delta_; |
412 | 468 |
413 rtc::CriticalSection crit_; | 469 rtc::CriticalSection crit_; |
414 std::deque<VideoFrame> frames_ GUARDED_BY(crit_); | 470 std::deque<VideoFrame> frames_ GUARDED_BY(crit_); |
415 VideoFrame last_rendered_frame_ GUARDED_BY(crit_); | 471 VideoFrame last_rendered_frame_ GUARDED_BY(crit_); |
416 std::map<uint32_t, int64_t> send_times_ GUARDED_BY(crit_); | 472 std::map<uint32_t, int64_t> send_times_ GUARDED_BY(crit_); |
417 std::map<uint32_t, int64_t> recv_times_ GUARDED_BY(crit_); | 473 std::map<uint32_t, int64_t> recv_times_ GUARDED_BY(crit_); |
418 VideoFrame first_send_frame_ GUARDED_BY(crit_); | 474 VideoFrame first_send_frame_ GUARDED_BY(crit_); |
419 const double avg_psnr_threshold_; | 475 const double avg_psnr_threshold_; |
420 const double avg_ssim_threshold_; | 476 const double avg_ssim_threshold_; |
421 | 477 |
422 rtc::CriticalSection comparison_lock_; | 478 rtc::CriticalSection comparison_lock_; |
423 std::vector<ThreadWrapper*> comparison_thread_pool_; | 479 std::vector<ThreadWrapper*> comparison_thread_pool_; |
480 rtc::scoped_ptr<ThreadWrapper> stats_polling_thread_; | |
424 const rtc::scoped_ptr<EventWrapper> comparison_available_event_; | 481 const rtc::scoped_ptr<EventWrapper> comparison_available_event_; |
425 std::deque<FrameComparison> comparisons_ GUARDED_BY(comparison_lock_); | 482 std::deque<FrameComparison> comparisons_ GUARDED_BY(comparison_lock_); |
426 const rtc::scoped_ptr<EventWrapper> done_; | 483 const rtc::scoped_ptr<EventWrapper> done_; |
427 }; | 484 }; |
428 | 485 |
429 void FullStackTest::RunTest(const FullStackTestParams& params) { | 486 void FullStackTest::RunTest(const FullStackTestParams& params) { |
430 test::DirectTransport send_transport(params.link); | 487 test::DirectTransport send_transport(params.link); |
431 test::DirectTransport recv_transport(params.link); | 488 test::DirectTransport recv_transport(params.link); |
432 VideoAnalyzer analyzer(nullptr, &send_transport, params.test_label, | 489 VideoAnalyzer analyzer(nullptr, &send_transport, params.test_label, |
433 params.avg_psnr_threshold, params.avg_ssim_threshold, | 490 params.avg_psnr_threshold, params.avg_ssim_threshold, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
471 stream->temporal_layer_thresholds_bps.push_back(stream->target_bitrate_bps); | 528 stream->temporal_layer_thresholds_bps.push_back(stream->target_bitrate_bps); |
472 } | 529 } |
473 | 530 |
474 CreateMatchingReceiveConfigs(); | 531 CreateMatchingReceiveConfigs(); |
475 receive_configs_[0].renderer = &analyzer; | 532 receive_configs_[0].renderer = &analyzer; |
476 receive_configs_[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 533 receive_configs_[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
477 receive_configs_[0].rtp.rtx[kSendRtxPayloadType].ssrc = kSendRtxSsrcs[0]; | 534 receive_configs_[0].rtp.rtx[kSendRtxPayloadType].ssrc = kSendRtxSsrcs[0]; |
478 receive_configs_[0].rtp.rtx[kSendRtxPayloadType].payload_type = | 535 receive_configs_[0].rtp.rtx[kSendRtxPayloadType].payload_type = |
479 kSendRtxPayloadType; | 536 kSendRtxPayloadType; |
480 | 537 |
538 for (auto& config : receive_configs_) | |
539 config.pre_decode_callback = &analyzer; | |
481 CreateStreams(); | 540 CreateStreams(); |
482 analyzer.input_ = send_stream_->Input(); | 541 analyzer.input_ = send_stream_->Input(); |
542 analyzer.send_stream_ = send_stream_; | |
483 | 543 |
484 if (params.screenshare) { | 544 if (params.screenshare) { |
485 std::vector<std::string> slides; | 545 std::vector<std::string> slides; |
486 slides.push_back(test::ResourcePath("web_screenshot_1850_1110", "yuv")); | 546 slides.push_back(test::ResourcePath("web_screenshot_1850_1110", "yuv")); |
487 slides.push_back(test::ResourcePath("presentation_1850_1110", "yuv")); | 547 slides.push_back(test::ResourcePath("presentation_1850_1110", "yuv")); |
488 slides.push_back(test::ResourcePath("photo_1850_1110", "yuv")); | 548 slides.push_back(test::ResourcePath("photo_1850_1110", "yuv")); |
489 slides.push_back(test::ResourcePath("difficult_photo_1850_1110", "yuv")); | 549 slides.push_back(test::ResourcePath("difficult_photo_1850_1110", "yuv")); |
490 | 550 |
491 rtc::scoped_ptr<test::FrameGenerator> frame_generator( | 551 rtc::scoped_ptr<test::FrameGenerator> frame_generator( |
492 test::FrameGenerator::CreateFromYuvFile( | 552 test::FrameGenerator::CreateFromYuvFile( |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
650 true, | 710 true, |
651 50000, | 711 50000, |
652 200000, | 712 200000, |
653 2000000, | 713 2000000, |
654 0.0, | 714 0.0, |
655 0.0, | 715 0.0, |
656 kFullStackTestDurationSecs}; | 716 kFullStackTestDurationSecs}; |
657 RunTest(screenshare_params); | 717 RunTest(screenshare_params); |
658 } | 718 } |
659 } // namespace webrtc | 719 } // namespace webrtc |
OLD | NEW |