Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: remoting/host/capture_scheduler_unittest.cc

Issue 171523003: Increase framerate limit in remoting host to 30fps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/host/capture_scheduler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/host/capture_scheduler.h" 5 #include "remoting/host/capture_scheduler.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 7
8 namespace remoting { 8 namespace remoting {
9 9
10 static const int kTestInputs[] = { 100, 50, 30, 20, 10, 30, 60, 80 }; 10 static const int kTestInputs[] = { 100, 50, 30, 20, 10, 30, 60, 80 };
11 static const int kMinumumFrameIntervalMs = 50;
11 12
12 TEST(CaptureSchedulerTest, SingleSampleSameTimes) { 13 TEST(CaptureSchedulerTest, SingleSampleSameTimes) {
13 const int kTestResults[][arraysize(kTestInputs)] = { 14 const int kTestResults[][arraysize(kTestInputs)] = {
14 { 400, 200, 120, 80, 50, 120, 240, 320 }, // One core. 15 { 400, 200, 120, 80, 50, 120, 240, 320 }, // One core.
15 { 200, 100, 60, 50, 50, 60, 120, 160 }, // Two cores. 16 { 200, 100, 60, 50, 50, 60, 120, 160 }, // Two cores.
16 { 100, 50, 50, 50, 50, 50, 60, 80 }, // Four cores. 17 { 100, 50, 50, 50, 50, 50, 60, 80 }, // Four cores.
17 { 50, 50, 50, 50, 50, 50, 50, 50 } // Eight cores. 18 { 50, 50, 50, 50, 50, 50, 50, 50 } // Eight cores.
18 }; 19 };
19 20
20 for (size_t i = 0; i < arraysize(kTestResults); ++i) { 21 for (size_t i = 0; i < arraysize(kTestResults); ++i) {
21 for (size_t j = 0; j < arraysize(kTestInputs); ++j) { 22 for (size_t j = 0; j < arraysize(kTestInputs); ++j) {
22 CaptureScheduler scheduler; 23 CaptureScheduler scheduler;
23 scheduler.SetNumOfProcessorsForTest(1 << i); 24 scheduler.SetNumOfProcessorsForTest(1 << i);
25 scheduler.set_minimum_interval(
26 base::TimeDelta::FromMilliseconds(kMinumumFrameIntervalMs));
24 scheduler.RecordCaptureTime( 27 scheduler.RecordCaptureTime(
25 base::TimeDelta::FromMilliseconds(kTestInputs[j])); 28 base::TimeDelta::FromMilliseconds(kTestInputs[j]));
26 scheduler.RecordEncodeTime( 29 scheduler.RecordEncodeTime(
27 base::TimeDelta::FromMilliseconds(kTestInputs[j])); 30 base::TimeDelta::FromMilliseconds(kTestInputs[j]));
28 EXPECT_EQ(kTestResults[i][j], 31 EXPECT_EQ(kTestResults[i][j],
29 scheduler.NextCaptureDelay().InMilliseconds()); 32 scheduler.NextCaptureDelay().InMilliseconds()) << i << " "<< j;
30 } 33 }
31 } 34 }
32 } 35 }
33 36
34 TEST(CaptureSchedulerTest, SingleSampleDifferentTimes) { 37 TEST(CaptureSchedulerTest, SingleSampleDifferentTimes) {
35 const int kTestResults[][arraysize(kTestInputs)] = { 38 const int kTestResults[][arraysize(kTestInputs)] = {
36 { 360, 220, 120, 60, 60, 120, 220, 360 }, // One core. 39 { 360, 220, 120, 60, 60, 120, 220, 360 }, // One core.
37 { 180, 110, 60, 50, 50, 60, 110, 180 }, // Two cores. 40 { 180, 110, 60, 50, 50, 60, 110, 180 }, // Two cores.
38 { 90, 55, 50, 50, 50, 50, 55, 90 }, // Four cores. 41 { 90, 55, 50, 50, 50, 50, 55, 90 }, // Four cores.
39 { 50, 50, 50, 50, 50, 50, 50, 50 } // Eight cores. 42 { 50, 50, 50, 50, 50, 50, 50, 50 } // Eight cores.
40 }; 43 };
41 44
42 for (size_t i = 0; i < arraysize(kTestResults); ++i) { 45 for (size_t i = 0; i < arraysize(kTestResults); ++i) {
43 for (size_t j = 0; j < arraysize(kTestInputs); ++j) { 46 for (size_t j = 0; j < arraysize(kTestInputs); ++j) {
44 CaptureScheduler scheduler; 47 CaptureScheduler scheduler;
45 scheduler.SetNumOfProcessorsForTest(1 << i); 48 scheduler.SetNumOfProcessorsForTest(1 << i);
49 scheduler.set_minimum_interval(
50 base::TimeDelta::FromMilliseconds(kMinumumFrameIntervalMs));
46 scheduler.RecordCaptureTime( 51 scheduler.RecordCaptureTime(
47 base::TimeDelta::FromMilliseconds(kTestInputs[j])); 52 base::TimeDelta::FromMilliseconds(kTestInputs[j]));
48 scheduler.RecordEncodeTime( 53 scheduler.RecordEncodeTime(
49 base::TimeDelta::FromMilliseconds( 54 base::TimeDelta::FromMilliseconds(
50 kTestInputs[arraysize(kTestInputs) - 1 - j])); 55 kTestInputs[arraysize(kTestInputs) - 1 - j]));
51 EXPECT_EQ(kTestResults[i][j], 56 EXPECT_EQ(kTestResults[i][j],
52 scheduler.NextCaptureDelay().InMilliseconds()); 57 scheduler.NextCaptureDelay().InMilliseconds());
53 } 58 }
54 } 59 }
55 } 60 }
56 61
57 TEST(CaptureSchedulerTest, RollingAverageDifferentTimes) { 62 TEST(CaptureSchedulerTest, RollingAverageDifferentTimes) {
58 const int kTestResults[][arraysize(kTestInputs)] = { 63 const int kTestResults[][arraysize(kTestInputs)] = {
59 { 360, 290, 233, 133, 80, 80, 133, 233 }, // One core. 64 { 360, 290, 233, 133, 80, 80, 133, 233 }, // One core.
60 { 180, 145, 116, 66, 50, 50, 66, 116 }, // Two cores. 65 { 180, 145, 116, 66, 50, 50, 66, 116 }, // Two cores.
61 { 90, 72, 58, 50, 50, 50, 50, 58 }, // Four cores. 66 { 90, 72, 58, 50, 50, 50, 50, 58 }, // Four cores.
62 { 50, 50, 50, 50, 50, 50, 50, 50 } // Eight cores. 67 { 50, 50, 50, 50, 50, 50, 50, 50 } // Eight cores.
63 }; 68 };
64 69
65 for (size_t i = 0; i < arraysize(kTestResults); ++i) { 70 for (size_t i = 0; i < arraysize(kTestResults); ++i) {
66 CaptureScheduler scheduler; 71 CaptureScheduler scheduler;
67 scheduler.SetNumOfProcessorsForTest(1 << i); 72 scheduler.SetNumOfProcessorsForTest(1 << i);
73 scheduler.set_minimum_interval(
74 base::TimeDelta::FromMilliseconds(kMinumumFrameIntervalMs));
68 for (size_t j = 0; j < arraysize(kTestInputs); ++j) { 75 for (size_t j = 0; j < arraysize(kTestInputs); ++j) {
69 scheduler.RecordCaptureTime( 76 scheduler.RecordCaptureTime(
70 base::TimeDelta::FromMilliseconds(kTestInputs[j])); 77 base::TimeDelta::FromMilliseconds(kTestInputs[j]));
71 scheduler.RecordEncodeTime( 78 scheduler.RecordEncodeTime(
72 base::TimeDelta::FromMilliseconds( 79 base::TimeDelta::FromMilliseconds(
73 kTestInputs[arraysize(kTestInputs) - 1 - j])); 80 kTestInputs[arraysize(kTestInputs) - 1 - j]));
74 EXPECT_EQ(kTestResults[i][j], 81 EXPECT_EQ(kTestResults[i][j],
75 scheduler.NextCaptureDelay().InMilliseconds()); 82 scheduler.NextCaptureDelay().InMilliseconds());
76 } 83 }
77 } 84 }
78 } 85 }
79 86
80 } // namespace remoting 87 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/capture_scheduler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698