OLD | NEW |
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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 float minAudioBufferSampleRate() { | 66 float minAudioBufferSampleRate() { |
67 // crbug.com/344375 | 67 // crbug.com/344375 |
68 return 3000; | 68 return 3000; |
69 } | 69 } |
70 | 70 |
71 float maxAudioBufferSampleRate() { | 71 float maxAudioBufferSampleRate() { |
72 // <video> tags support sample rates up 384 kHz so audio context | 72 // <video> tags support sample rates up 384 kHz so audio context |
73 // should too. | 73 // should too. |
74 return 384000; | 74 return 384000; |
75 } | 75 } |
| 76 |
| 77 bool isPowerOfTwo(size_t x) { |
| 78 // From Hacker's Delight. x & (x - 1) turns off (zeroes) the |
| 79 // rightmost 1-bit in the word x. If x is a power of two, then the |
| 80 // result is, of course, 0. |
| 81 return x > 0 && ((x & (x - 1)) == 0); |
| 82 } |
| 83 |
76 } // namespace AudioUtilities | 84 } // namespace AudioUtilities |
77 | 85 |
78 } // namespace blink | 86 } // namespace blink |
OLD | NEW |