• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2019 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 
11 #include "test/gtest.h"
12 #include "test/peer_scenario/peer_scenario.h"
13 #include "test/peer_scenario/peer_scenario_client.h"
14 
15 namespace webrtc {
16 namespace test {
17 #if defined(WEBRTC_WIN)
18 #define MAYBE_PsnrIsCollected DISABLED_PsnrIsCollected
19 #else
20 #define MAYBE_PsnrIsCollected PsnrIsCollected
21 #endif
TEST(PeerScenarioQualityTest,MAYBE_PsnrIsCollected)22 TEST(PeerScenarioQualityTest, MAYBE_PsnrIsCollected) {
23   VideoQualityAnalyzer analyzer;
24   {
25     PeerScenario s(*test_info_);
26     auto caller = s.CreateClient(PeerScenarioClient::Config());
27     auto callee = s.CreateClient(PeerScenarioClient::Config());
28     PeerScenarioClient::VideoSendTrackConfig video_conf;
29     video_conf.generator.squares_video->framerate = 20;
30     auto video = caller->CreateVideo("VIDEO", video_conf);
31     auto link_builder = s.net()->NodeBuilder().delay_ms(100).capacity_kbps(600);
32     s.AttachVideoQualityAnalyzer(&analyzer, video.track, callee);
33     s.SimpleConnection(caller, callee, {link_builder.Build().node},
34                        {link_builder.Build().node});
35     s.ProcessMessages(TimeDelta::Seconds(2));
36     // Exit scope to ensure that there's no pending tasks reporting to analyzer.
37   }
38 
39   // We expect ca 40 frames to be produced, but to avoid flakiness on slow
40   // machines we only test for 10.
41   EXPECT_GT(analyzer.stats().render.count, 10);
42   EXPECT_GT(analyzer.stats().psnr_with_freeze.Mean(), 20);
43 }
44 
45 }  // namespace test
46 }  // namespace webrtc
47