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> |
5 #include "build/build_config.h" | 8 #include "build/build_config.h" |
6 #include "ppapi/shared_impl/ppb_audio_config_shared.h" | |
7 #include "ppapi/thunk/enter.h" | 9 #include "ppapi/thunk/enter.h" |
8 #include "ppapi/thunk/ppb_instance_api.h" | 10 #include "ppapi/thunk/ppb_instance_api.h" |
9 | 11 |
10 namespace ppapi { | 12 namespace ppapi { |
11 | 13 |
12 // Rounds up requested_size to the nearest multiple of minimum_size. | 14 // Rounds up requested_size to the nearest multiple of minimum_size. |
13 static uint32_t CalculateMultipleOfSampleFrameCount(uint32_t minimum_size, | 15 static uint32_t CalculateMultipleOfSampleFrameCount(uint32_t minimum_size, |
14 uint32_t requested_size) { | 16 uint32_t requested_size) { |
15 const uint32_t multiple = (requested_size + minimum_size - 1) / minimum_size; | 17 const uint32_t multiple = (requested_size + minimum_size - 1) / minimum_size; |
16 return std::min(minimum_size * multiple, | 18 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 || | 171 if (sample_frame_count > PP_AUDIOMAXSAMPLEFRAMECOUNT || |
170 sample_frame_count < PP_AUDIOMINSAMPLEFRAMECOUNT) | 172 sample_frame_count < PP_AUDIOMINSAMPLEFRAMECOUNT) |
171 return false; | 173 return false; |
172 | 174 |
173 sample_rate_ = sample_rate; | 175 sample_rate_ = sample_rate; |
174 sample_frame_count_ = sample_frame_count; | 176 sample_frame_count_ = sample_frame_count; |
175 return true; | 177 return true; |
176 } | 178 } |
177 | 179 |
178 } // namespace ppapi | 180 } // namespace ppapi |
OLD | NEW |