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

Unified Diff: media/audio/point.cc

Issue 1907973003: media: Move audio_parameters and audio_point to media/base/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/audio/point.h ('k') | media/audio/point_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/point.cc
diff --git a/media/audio/point.cc b/media/audio/point.cc
deleted file mode 100644
index 7745bc2c03b94c2e7f4b385d004c710c3d9c5439..0000000000000000000000000000000000000000
--- a/media/audio/point.cc
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "media/audio/point.h"
-
-#include <stddef.h>
-
-#include "base/logging.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/strings/string_split.h"
-#include "base/strings/string_util.h"
-#include "base/strings/stringprintf.h"
-
-namespace media {
-
-std::string PointsToString(const std::vector<Point>& points) {
- std::string points_string;
- if (!points.empty()) {
- for (size_t i = 0; i < points.size() - 1; ++i) {
- points_string.append(points[i].ToString());
- points_string.append(", ");
- }
- points_string.append(points.back().ToString());
- }
- return points_string;
-}
-
-std::vector<Point> ParsePointsFromString(const std::string& points_string) {
- std::vector<Point> points;
- if (points_string.empty())
- return points;
-
- const auto& tokens =
- base::SplitString(points_string, base::kWhitespaceASCII,
- base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
- if (tokens.size() < 3 || tokens.size() % 3 != 0) {
- LOG(ERROR) << "Malformed points string: " << points_string;
- return points;
- }
-
- std::vector<float> float_tokens;
- float_tokens.reserve(tokens.size());
- for (const auto& token : tokens) {
- double float_token;
- if (!base::StringToDouble(token, &float_token)) {
- LOG(ERROR) << "Unable to convert token=" << token
- << " to double from points string: " << points_string;
- return points;
- }
- float_tokens.push_back(float_token);
- }
-
- points.reserve(float_tokens.size() / 3);
- for (size_t i = 0; i < float_tokens.size(); i += 3) {
- points.push_back(
- Point(float_tokens[i + 0], float_tokens[i + 1], float_tokens[i + 2]));
- }
-
- return points;
-}
-
-} // namespace media
« no previous file with comments | « media/audio/point.h ('k') | media/audio/point_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698