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

Side by Side Diff: media/filters/video_cadence_estimator_unittest.cc

Issue 1278973003: Revert of Update SplitString calls to new form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « media/filters/source_buffer_stream_unittest.cc ('k') | media/formats/mp4/avc_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "base/strings/string_number_conversions.h" 6 #include "base/strings/string_number_conversions.h"
7 #include "base/strings/string_split.h" 7 #include "base/strings/string_split.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "media/filters/video_cadence_estimator.h" 9 #include "media/filters/video_cadence_estimator.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 namespace media { 12 namespace media {
13 13
14 // See VideoCadenceEstimator header for more details. 14 // See VideoCadenceEstimator header for more details.
15 const int kMinimumAcceptableTimeBetweenGlitchesSecs = 8; 15 const int kMinimumAcceptableTimeBetweenGlitchesSecs = 8;
16 16
17 // Slows down the given |fps| according to NTSC field reduction standards; see 17 // Slows down the given |fps| according to NTSC field reduction standards; see
18 // http://en.wikipedia.org/wiki/Frame_rate#Digital_video_and_television 18 // http://en.wikipedia.org/wiki/Frame_rate#Digital_video_and_television
19 static double NTSC(double fps) { 19 static double NTSC(double fps) {
20 return fps / 1.001; 20 return fps / 1.001;
21 } 21 }
22 22
23 static base::TimeDelta Interval(double hertz) { 23 static base::TimeDelta Interval(double hertz) {
24 return base::TimeDelta::FromSecondsD(1.0 / hertz); 24 return base::TimeDelta::FromSecondsD(1.0 / hertz);
25 } 25 }
26 26
27 std::vector<int> CreateCadenceFromString(const std::string& cadence) { 27 std::vector<int> CreateCadenceFromString(const std::string& cadence) {
28 std::vector<std::string> tokens;
28 CHECK_EQ('[', cadence[0]); 29 CHECK_EQ('[', cadence[0]);
29 CHECK_EQ(']', cadence[cadence.length() - 1]); 30 CHECK_EQ(']', cadence[cadence.length() - 1]);
31 base::SplitString(cadence.substr(1, cadence.length() - 2), ':', &tokens);
30 32
31 std::vector<int> result; 33 std::vector<int> result;
32 for (const std::string& token : 34 for (const auto& token : tokens) {
33 base::SplitString(cadence.substr(1, cadence.length() - 2),
34 ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) {
35 int cadence_value = 0; 35 int cadence_value = 0;
36 CHECK(base::StringToInt(token, &cadence_value)) << token; 36 CHECK(base::StringToInt(token, &cadence_value)) << token;
37 result.push_back(cadence_value); 37 result.push_back(cadence_value);
38 } 38 }
39 39
40 return result; 40 return result;
41 } 41 }
42 42
43 static void VerifyCadenceVector(VideoCadenceEstimator* estimator, 43 static void VerifyCadenceVector(VideoCadenceEstimator* estimator,
44 double frame_hertz, 44 double frame_hertz,
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 const base::TimeDelta render_interval = 195 const base::TimeDelta render_interval =
196 base::TimeDelta::FromMicroseconds(16715); 196 base::TimeDelta::FromMicroseconds(16715);
197 const base::TimeDelta frame_duration = 197 const base::TimeDelta frame_duration =
198 base::TimeDelta::FromMicroseconds(33360); 198 base::TimeDelta::FromMicroseconds(33360);
199 199
200 EXPECT_TRUE(estimator.UpdateCadenceEstimate(render_interval, frame_duration, 200 EXPECT_TRUE(estimator.UpdateCadenceEstimate(render_interval, frame_duration,
201 frame_duration / 2)); 201 frame_duration / 2));
202 } 202 }
203 203
204 } // namespace media 204 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/source_buffer_stream_unittest.cc ('k') | media/formats/mp4/avc_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698