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" | 5 #include "ppapi/shared_impl/ppb_audio_config_shared.h" |
6 #include "ppapi/thunk/enter.h" | 6 #include "ppapi/thunk/enter.h" |
7 #include "ppapi/thunk/ppb_instance_api.h" | 7 #include "ppapi/thunk/ppb_instance_api.h" |
8 | 8 |
9 namespace ppapi { | 9 namespace ppapi { |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 uint32_t PPB_AudioConfig_Shared::RecommendSampleFrameCount_1_1( | 47 uint32_t PPB_AudioConfig_Shared::RecommendSampleFrameCount_1_1( |
48 PP_Instance instance, | 48 PP_Instance instance, |
49 PP_AudioSampleRate sample_rate, | 49 PP_AudioSampleRate sample_rate, |
50 uint32_t sample_frame_count) { | 50 uint32_t sample_frame_count) { |
51 // Version 1.1: Query the back-end hardware for sample rate and buffer size, | 51 // Version 1.1: Query the back-end hardware for sample rate and buffer size, |
52 // and recommend a best fit based on request. | 52 // and recommend a best fit based on request. |
53 thunk::EnterInstanceNoLock enter(instance); | 53 thunk::EnterInstanceNoLock enter(instance); |
54 if (enter.failed()) | 54 if (enter.failed()) |
55 return 0; | 55 return 0; |
56 | 56 |
| 57 return 2048; |
| 58 |
57 // Get the hardware config. | 59 // Get the hardware config. |
58 PP_AudioSampleRate hardware_sample_rate = static_cast<PP_AudioSampleRate>( | 60 PP_AudioSampleRate hardware_sample_rate = static_cast<PP_AudioSampleRate>( |
59 enter.functions()->GetAudioHardwareOutputSampleRate(instance)); | 61 enter.functions()->GetAudioHardwareOutputSampleRate(instance)); |
60 uint32_t hardware_sample_frame_count = | 62 uint32_t hardware_sample_frame_count = |
61 enter.functions()->GetAudioHardwareOutputBufferSize(instance); | 63 enter.functions()->GetAudioHardwareOutputBufferSize(instance); |
62 if (sample_frame_count < PP_AUDIOMINSAMPLEFRAMECOUNT) | 64 if (sample_frame_count < PP_AUDIOMINSAMPLEFRAMECOUNT) |
63 sample_frame_count = PP_AUDIOMINSAMPLEFRAMECOUNT; | 65 sample_frame_count = PP_AUDIOMINSAMPLEFRAMECOUNT; |
64 | 66 |
65 // If client is using same sample rate as audio hardware, then recommend a | 67 // If client is using same sample rate as audio hardware, then recommend a |
66 // multiple of the audio hardware's sample frame count. | 68 // multiple of the audio hardware's sample frame count. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 if (sample_frame_count > PP_AUDIOMAXSAMPLEFRAMECOUNT || | 127 if (sample_frame_count > PP_AUDIOMAXSAMPLEFRAMECOUNT || |
126 sample_frame_count < PP_AUDIOMINSAMPLEFRAMECOUNT) | 128 sample_frame_count < PP_AUDIOMINSAMPLEFRAMECOUNT) |
127 return false; | 129 return false; |
128 | 130 |
129 sample_rate_ = sample_rate; | 131 sample_rate_ = sample_rate; |
130 sample_frame_count_ = sample_frame_count; | 132 sample_frame_count_ = sample_frame_count; |
131 return true; | 133 return true; |
132 } | 134 } |
133 | 135 |
134 } // namespace ppapi | 136 } // namespace ppapi |
OLD | NEW |