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

Side by Side Diff: third_party/WebKit/Source/platform/audio/HRTFDatabase.cpp

Issue 2803733002: Convert ASSERT(foo) to DCHECK(foo) in platform/audio (Closed)
Patch Set: Mechanical change from ASSERT(foo) to DCHECK(foo) Created 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 return WTF::wrapUnique(new HRTFDatabase(sampleRate)); 47 return WTF::wrapUnique(new HRTFDatabase(sampleRate));
48 } 48 }
49 49
50 HRTFDatabase::HRTFDatabase(float sampleRate) 50 HRTFDatabase::HRTFDatabase(float sampleRate)
51 : m_elevations(NumberOfTotalElevations), m_sampleRate(sampleRate) { 51 : m_elevations(NumberOfTotalElevations), m_sampleRate(sampleRate) {
52 unsigned elevationIndex = 0; 52 unsigned elevationIndex = 0;
53 for (int elevation = MinElevation; elevation <= MaxElevation; 53 for (int elevation = MinElevation; elevation <= MaxElevation;
54 elevation += RawElevationAngleSpacing) { 54 elevation += RawElevationAngleSpacing) {
55 std::unique_ptr<HRTFElevation> hrtfElevation = 55 std::unique_ptr<HRTFElevation> hrtfElevation =
56 HRTFElevation::createForSubject("Composite", elevation, sampleRate); 56 HRTFElevation::createForSubject("Composite", elevation, sampleRate);
57 ASSERT(hrtfElevation.get()); 57 DCHECK(hrtfElevation.get());
58 if (!hrtfElevation.get()) 58 if (!hrtfElevation.get())
59 return; 59 return;
60 60
61 m_elevations[elevationIndex] = std::move(hrtfElevation); 61 m_elevations[elevationIndex] = std::move(hrtfElevation);
62 elevationIndex += InterpolationFactor; 62 elevationIndex += InterpolationFactor;
63 } 63 }
64 64
65 // Now, go back and interpolate elevations. 65 // Now, go back and interpolate elevations.
66 if (InterpolationFactor > 1) { 66 if (InterpolationFactor > 1) {
67 for (unsigned i = 0; i < NumberOfTotalElevations; 67 for (unsigned i = 0; i < NumberOfTotalElevations;
(...skipping 28 matching lines...) Expand all
96 if (!m_elevations.size()) { 96 if (!m_elevations.size()) {
97 kernelL = 0; 97 kernelL = 0;
98 kernelR = 0; 98 kernelR = 0;
99 return; 99 return;
100 } 100 }
101 101
102 if (elevationIndex > m_elevations.size() - 1) 102 if (elevationIndex > m_elevations.size() - 1)
103 elevationIndex = m_elevations.size() - 1; 103 elevationIndex = m_elevations.size() - 1;
104 104
105 HRTFElevation* hrtfElevation = m_elevations[elevationIndex].get(); 105 HRTFElevation* hrtfElevation = m_elevations[elevationIndex].get();
106 ASSERT(hrtfElevation); 106 DCHECK(hrtfElevation);
107 if (!hrtfElevation) { 107 if (!hrtfElevation) {
108 kernelL = 0; 108 kernelL = 0;
109 kernelR = 0; 109 kernelR = 0;
110 return; 110 return;
111 } 111 }
112 112
113 hrtfElevation->getKernelsFromAzimuth(azimuthBlend, azimuthIndex, kernelL, 113 hrtfElevation->getKernelsFromAzimuth(azimuthBlend, azimuthIndex, kernelL,
114 kernelR, frameDelayL, frameDelayR); 114 kernelR, frameDelayL, frameDelayR);
115 } 115 }
116 116
117 unsigned HRTFDatabase::indexFromElevationAngle(double elevationAngle) { 117 unsigned HRTFDatabase::indexFromElevationAngle(double elevationAngle) {
118 // Clamp to allowed range. 118 // Clamp to allowed range.
119 elevationAngle = 119 elevationAngle =
120 clampTo<double, double>(elevationAngle, MinElevation, MaxElevation); 120 clampTo<double, double>(elevationAngle, MinElevation, MaxElevation);
121 121
122 unsigned elevationIndex = 122 unsigned elevationIndex =
123 static_cast<int>(InterpolationFactor * (elevationAngle - MinElevation) / 123 static_cast<int>(InterpolationFactor * (elevationAngle - MinElevation) /
124 RawElevationAngleSpacing); 124 RawElevationAngleSpacing);
125 return elevationIndex; 125 return elevationIndex;
126 } 126 }
127 127
128 } // namespace blink 128 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698