OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/proxy/ppb_audio_config_proxy.h" | 5 #include "ppapi/proxy/ppb_audio_config_proxy.h" |
6 | 6 |
7 #include "ppapi/c/ppb_audio_config.h" | 7 #include "ppapi/c/ppb_audio_config.h" |
8 #include "ppapi/proxy/plugin_dispatcher.h" | 8 #include "ppapi/proxy/plugin_dispatcher.h" |
9 #include "ppapi/proxy/plugin_resource.h" | 9 #include "ppapi/proxy/plugin_resource.h" |
10 #include "ppapi/proxy/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 PP_Resource CreateStereo16bit(PP_Instance instance, | 41 PP_Resource CreateStereo16bit(PP_Instance instance, |
42 PP_AudioSampleRate sample_rate, | 42 PP_AudioSampleRate sample_rate, |
43 uint32_t sample_frame_count) { | 43 uint32_t sample_frame_count) { |
44 HostResource resource; | 44 HostResource resource; |
45 PluginDispatcher::GetForInstance(instance)->Send( | 45 PluginDispatcher::GetForInstance(instance)->Send( |
46 new PpapiHostMsg_PPBAudioConfig_Create( | 46 new PpapiHostMsg_PPBAudioConfig_Create( |
47 INTERFACE_ID_PPB_AUDIO_CONFIG, instance, | 47 INTERFACE_ID_PPB_AUDIO_CONFIG, instance, |
48 static_cast<int32_t>(sample_rate), sample_frame_count, | 48 static_cast<int32_t>(sample_rate), sample_frame_count, |
49 &resource)); | 49 &resource)); |
50 if (!resource.is_null()) | 50 if (resource.is_null()) |
51 return 0; | 51 return 0; |
52 | 52 |
53 linked_ptr<AudioConfig> object( | 53 linked_ptr<AudioConfig> object( |
54 new AudioConfig(resource, sample_rate, sample_frame_count)); | 54 new AudioConfig(resource, sample_rate, sample_frame_count)); |
55 return PluginResourceTracker::GetInstance()->AddResource(object); | 55 return PluginResourceTracker::GetInstance()->AddResource(object); |
56 } | 56 } |
57 | 57 |
58 uint32_t RecommendSampleFrameCount(PP_AudioSampleRate sample_rate, | 58 uint32_t RecommendSampleFrameCount(PP_AudioSampleRate sample_rate, |
59 uint32_t requested_sample_frame_count) { | 59 uint32_t requested_sample_frame_count) { |
60 // TODO(brettw) Currently we don't actually query to get a value from the | 60 // TODO(brettw) Currently we don't actually query to get a value from the |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 int32_t sample_rate, | 139 int32_t sample_rate, |
140 uint32_t requested_sample_frame_count, | 140 uint32_t requested_sample_frame_count, |
141 uint32_t* result) { | 141 uint32_t* result) { |
142 *result = ppb_audio_config_target()->RecommendSampleFrameCount( | 142 *result = ppb_audio_config_target()->RecommendSampleFrameCount( |
143 static_cast<PP_AudioSampleRate>(sample_rate), | 143 static_cast<PP_AudioSampleRate>(sample_rate), |
144 requested_sample_frame_count); | 144 requested_sample_frame_count); |
145 } | 145 } |
146 | 146 |
147 } // namespace proxy | 147 } // namespace proxy |
148 } // namespace pp | 148 } // namespace pp |
OLD | NEW |