OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ppapi/shared_impl/ppb_audio_config_shared.h" |
| 6 |
| 7 #include <algorithm> |
| 8 |
5 #include "build/build_config.h" | 9 #include "build/build_config.h" |
6 #include "ppapi/shared_impl/ppb_audio_config_shared.h" | |
7 #include "ppapi/thunk/enter.h" | 10 #include "ppapi/thunk/enter.h" |
8 #include "ppapi/thunk/ppb_instance_api.h" | 11 #include "ppapi/thunk/ppb_instance_api.h" |
9 | 12 |
10 namespace ppapi { | 13 namespace ppapi { |
11 | 14 |
12 // Rounds up requested_size to the nearest multiple of minimum_size. | 15 // Rounds up requested_size to the nearest multiple of minimum_size. |
13 static uint32_t CalculateMultipleOfSampleFrameCount(uint32_t minimum_size, | 16 static uint32_t CalculateMultipleOfSampleFrameCount(uint32_t minimum_size, |
14 uint32_t requested_size) { | 17 uint32_t requested_size) { |
15 const uint32_t multiple = (requested_size + minimum_size - 1) / minimum_size; | 18 const uint32_t multiple = (requested_size + minimum_size - 1) / minimum_size; |
16 return std::min(minimum_size * multiple, | 19 return std::min(minimum_size * multiple, |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 if (sample_frame_count > PP_AUDIOMAXSAMPLEFRAMECOUNT || | 172 if (sample_frame_count > PP_AUDIOMAXSAMPLEFRAMECOUNT || |
170 sample_frame_count < PP_AUDIOMINSAMPLEFRAMECOUNT) | 173 sample_frame_count < PP_AUDIOMINSAMPLEFRAMECOUNT) |
171 return false; | 174 return false; |
172 | 175 |
173 sample_rate_ = sample_rate; | 176 sample_rate_ = sample_rate; |
174 sample_frame_count_ = sample_frame_count; | 177 sample_frame_count_ = sample_frame_count; |
175 return true; | 178 return true; |
176 } | 179 } |
177 | 180 |
178 } // namespace ppapi | 181 } // namespace ppapi |
OLD | NEW |