diff options
author | nfullagar@google.com <nfullagar@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-15 01:04:00 +0000 |
---|---|---|
committer | nfullagar@google.com <nfullagar@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-15 01:04:00 +0000 |
commit | b9a598494478fe8c04b6b7ba1f982ab91be6a521 (patch) | |
tree | 9b76d2753d28ace9a7efa5957342e8ad5cdadf45 /ppapi/proxy | |
parent | 97d2f1d24de99d6c19bf053fa7d3e61ede99e9c5 (diff) | |
download | chromium_src-b9a598494478fe8c04b6b7ba1f982ab91be6a521.zip chromium_src-b9a598494478fe8c04b6b7ba1f982ab91be6a521.tar.gz chromium_src-b9a598494478fe8c04b6b7ba1f982ab91be6a521.tar.bz2 |
Move ppapi audio interface out of dev, but
for this CL, also keep the old dev interface
around temporarily, to avoid tree breakage.
Add sample_rate to RecommendSampleFrameCount() to the
non-dev audio interface. Currently ignored, but useful
information to use when we need to refine RecommendSampleFrameCount()
Review URL: http://codereview.chromium.org/6279003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71527 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy')
-rw-r--r-- | ppapi/proxy/dispatcher.cc | 8 | ||||
-rw-r--r-- | ppapi/proxy/ppapi_messages_internal.h | 3 | ||||
-rw-r--r-- | ppapi/proxy/ppb_audio_config_proxy.cc | 30 | ||||
-rw-r--r-- | ppapi/proxy/ppb_audio_config_proxy.h | 10 | ||||
-rw-r--r-- | ppapi/proxy/ppb_audio_proxy.cc | 18 | ||||
-rw-r--r-- | ppapi/proxy/ppb_audio_proxy.h | 6 |
6 files changed, 41 insertions, 34 deletions
diff --git a/ppapi/proxy/dispatcher.cc b/ppapi/proxy/dispatcher.cc index d984222..0ae8e2e 100644 --- a/ppapi/proxy/dispatcher.cc +++ b/ppapi/proxy/dispatcher.cc @@ -12,8 +12,6 @@ #include "base/logging.h" #include "ipc/ipc_message.h" #include "ipc/ipc_sync_channel.h" -#include "ppapi/c/dev/ppb_audio_config_dev.h" -#include "ppapi/c/dev/ppb_audio_dev.h" #include "ppapi/c/dev/ppb_buffer_dev.h" #include "ppapi/c/dev/ppb_char_set_dev.h" #include "ppapi/c/dev/ppb_cursor_control_dev.h" @@ -24,6 +22,8 @@ #include "ppapi/c/dev/ppb_testing_dev.h" #include "ppapi/c/dev/ppb_var_deprecated.h" #include "ppapi/c/pp_errors.h" +#include "ppapi/c/ppb_audio.h" +#include "ppapi/c/ppb_audio_config.h" #include "ppapi/c/ppb_core.h" #include "ppapi/c/ppb_graphics_2d.h" #include "ppapi/c/ppb_image_data.h" @@ -229,9 +229,9 @@ void Dispatcher::OnMsgDeclareInterfaces( InterfaceProxy* Dispatcher::CreateProxyForInterface( const std::string& interface_name, const void* interface_functions) { - if (interface_name == PPB_AUDIO_CONFIG_DEV_INTERFACE) + if (interface_name == PPB_AUDIO_CONFIG_INTERFACE) return new PPB_AudioConfig_Proxy(this, interface_functions); - if (interface_name == PPB_AUDIO_DEV_INTERFACE) + if (interface_name == PPB_AUDIO_INTERFACE) return new PPB_Audio_Proxy(this, interface_functions); if (interface_name == PPB_BUFFER_DEV_INTERFACE) return new PPB_Buffer_Proxy(this, interface_functions); diff --git a/ppapi/proxy/ppapi_messages_internal.h b/ppapi/proxy/ppapi_messages_internal.h index f593aea..ca34ecf 100644 --- a/ppapi/proxy/ppapi_messages_internal.h +++ b/ppapi/proxy/ppapi_messages_internal.h @@ -171,8 +171,9 @@ IPC_SYNC_MESSAGE_ROUTED3_1(PpapiHostMsg_PPBAudioConfig_Create, int32_t /* sample_rate */, uint32_t /* sample_frame_count */, PP_Resource /* result */) -IPC_SYNC_MESSAGE_ROUTED1_1( +IPC_SYNC_MESSAGE_ROUTED2_1( PpapiHostMsg_PPBAudioConfig_RecommendSampleFrameCount, + int32_t /* sample_rate */, uint32_t /* requested */, uint32_t /* result */) diff --git a/ppapi/proxy/ppb_audio_config_proxy.cc b/ppapi/proxy/ppb_audio_config_proxy.cc index 40abd4f..1675217 100644 --- a/ppapi/proxy/ppb_audio_config_proxy.cc +++ b/ppapi/proxy/ppb_audio_config_proxy.cc @@ -4,7 +4,7 @@ #include "ppapi/proxy/ppb_audio_config_proxy.h" -#include "ppapi/c/dev/ppb_audio_config_dev.h" +#include "ppapi/c/ppb_audio_config.h" #include "ppapi/proxy/plugin_dispatcher.h" #include "ppapi/proxy/plugin_resource.h" #include "ppapi/proxy/ppapi_messages.h" @@ -14,7 +14,7 @@ namespace proxy { class AudioConfig : public PluginResource { public: - AudioConfig(PP_AudioSampleRate_Dev sample_rate, uint32_t sample_frame_count) + AudioConfig(PP_AudioSampleRate sample_rate, uint32_t sample_frame_count) : sample_rate_(sample_rate), sample_frame_count_(sample_frame_count) { } @@ -23,11 +23,11 @@ class AudioConfig : public PluginResource { // Resource overrides. virtual AudioConfig* AsAudioConfig() { return this; } - PP_AudioSampleRate_Dev sample_rate() const { return sample_rate_; } + PP_AudioSampleRate sample_rate() const { return sample_rate_; } uint32_t sample_frame_count() const { return sample_frame_count_; } private: - PP_AudioSampleRate_Dev sample_rate_; + PP_AudioSampleRate sample_rate_; uint32_t sample_frame_count_; DISALLOW_COPY_AND_ASSIGN(AudioConfig); @@ -36,7 +36,7 @@ class AudioConfig : public PluginResource { namespace { PP_Resource CreateStereo16bit(PP_Module module_id, - PP_AudioSampleRate_Dev sample_rate, + PP_AudioSampleRate sample_rate, uint32_t sample_frame_count) { PP_Resource result = 0; PluginDispatcher::Get()->Send(new PpapiHostMsg_PPBAudioConfig_Create( @@ -53,12 +53,13 @@ PP_Resource CreateStereo16bit(PP_Module module_id, return result; } -uint32_t RecommendSampleFrameCount(uint32_t requested_sample_frame_count) { +uint32_t RecommendSampleFrameCount(PP_AudioSampleRate sample_rate, + uint32_t requested_sample_frame_count) { uint32_t result = 0; PluginDispatcher::Get()->Send( new PpapiHostMsg_PPBAudioConfig_RecommendSampleFrameCount( - INTERFACE_ID_PPB_AUDIO_CONFIG, requested_sample_frame_count, - &result)); + INTERFACE_ID_PPB_AUDIO_CONFIG, static_cast<int32_t>(sample_rate), + requested_sample_frame_count, &result)); return result; } @@ -67,7 +68,7 @@ PP_Bool IsAudioConfig(PP_Resource resource) { return BoolToPPBool(!!object); } -PP_AudioSampleRate_Dev GetSampleRate(PP_Resource config_id) { +PP_AudioSampleRate GetSampleRate(PP_Resource config_id) { AudioConfig* object = PluginResource::GetAs<AudioConfig>(config_id); if (!object) return PP_AUDIOSAMPLERATE_NONE; @@ -81,7 +82,7 @@ uint32_t GetSampleFrameCount(PP_Resource config_id) { return object->sample_frame_count(); } -const PPB_AudioConfig_Dev audio_config_interface = { +const PPB_AudioConfig audio_config_interface = { &CreateStereo16bit, &RecommendSampleFrameCount, &IsAudioConfig, @@ -124,14 +125,17 @@ void PPB_AudioConfig_Proxy::OnMsgCreateStereo16Bit(PP_Module module, uint32_t sample_frame_count, PP_Resource* result) { *result = ppb_audio_config_target()->CreateStereo16Bit( - module, static_cast<PP_AudioSampleRate_Dev>(sample_rate), + module, static_cast<PP_AudioSampleRate>(sample_rate), sample_frame_count); } void PPB_AudioConfig_Proxy::OnMsgRecommendSampleFrameCount( - uint32_t requested, + int32_t sample_rate, + uint32_t requested_sample_frame_count, uint32_t* result) { - *result = ppb_audio_config_target()->RecommendSampleFrameCount(requested); + *result = ppb_audio_config_target()->RecommendSampleFrameCount( + static_cast<PP_AudioSampleRate>(sample_rate), + requested_sample_frame_count); } } // namespace proxy diff --git a/ppapi/proxy/ppb_audio_config_proxy.h b/ppapi/proxy/ppb_audio_config_proxy.h index 0236216..459d791 100644 --- a/ppapi/proxy/ppb_audio_config_proxy.h +++ b/ppapi/proxy/ppb_audio_config_proxy.h @@ -10,7 +10,7 @@ #include "ppapi/c/pp_resource.h" #include "ppapi/proxy/interface_proxy.h" -struct PPB_AudioConfig_Dev; +struct PPB_AudioConfig; namespace pp { namespace proxy { @@ -20,8 +20,8 @@ class PPB_AudioConfig_Proxy : public InterfaceProxy { PPB_AudioConfig_Proxy(Dispatcher* dispatcher, const void* target_interface); virtual ~PPB_AudioConfig_Proxy(); - const PPB_AudioConfig_Dev* ppb_audio_config_target() const { - return static_cast<const PPB_AudioConfig_Dev*>(target_interface()); + const PPB_AudioConfig* ppb_audio_config_target() const { + return static_cast<const PPB_AudioConfig*>(target_interface()); } // InterfaceProxy implementation. @@ -35,7 +35,9 @@ class PPB_AudioConfig_Proxy : public InterfaceProxy { int32_t sample_rate, uint32_t sample_frame_count, PP_Resource* result); - void OnMsgRecommendSampleFrameCount(uint32_t requested, uint32_t* result); + void OnMsgRecommendSampleFrameCount(int32_t sample_rate, + uint32_t requested, + uint32_t* result); DISALLOW_COPY_AND_ASSIGN(PPB_AudioConfig_Proxy); }; diff --git a/ppapi/proxy/ppb_audio_proxy.cc b/ppapi/proxy/ppb_audio_proxy.cc index e23ac4e..aa8ab92 100644 --- a/ppapi/proxy/ppb_audio_proxy.cc +++ b/ppapi/proxy/ppb_audio_proxy.cc @@ -5,9 +5,9 @@ #include "ppapi/proxy/ppb_audio_proxy.h" #include "base/threading/simple_thread.h" -#include "ppapi/c/dev/ppb_audio_dev.h" -#include "ppapi/c/dev/ppb_audio_trusted_dev.h" #include "ppapi/c/pp_errors.h" +#include "ppapi/c/ppb_audio.h" +#include "ppapi/c/trusted/ppb_audio_trusted.h" #include "ppapi/proxy/interface_id.h" #include "ppapi/proxy/plugin_dispatcher.h" #include "ppapi/proxy/plugin_resource.h" @@ -105,7 +105,7 @@ PP_Bool StopPlayback(PP_Resource audio_id) { return PP_TRUE; } -const PPB_Audio_Dev audio_interface = { +const PPB_Audio audio_interface = { &Create, &IsAudio, &GetCurrentConfiguration, @@ -148,9 +148,9 @@ bool PPB_Audio_Proxy::OnMessageReceived(const IPC::Message& msg) { void PPB_Audio_Proxy::OnMsgCreate(PP_Instance instance_id, PP_Resource config_id, PP_Resource* result) { - const PPB_AudioTrusted_Dev* audio_trusted = - reinterpret_cast<const PPB_AudioTrusted_Dev*>( - dispatcher()->GetLocalInterface(PPB_AUDIO_TRUSTED_DEV_INTERFACE)); + const PPB_AudioTrusted* audio_trusted = + reinterpret_cast<const PPB_AudioTrusted*>( + dispatcher()->GetLocalInterface(PPB_AUDIO_TRUSTED_INTERFACE)); if (!audio_trusted) { *result = 0; return; @@ -231,9 +231,9 @@ int32_t PPB_Audio_Proxy::GetAudioConnectedHandles( base::SharedMemoryHandle* foreign_shared_memory_handle, uint32_t* shared_memory_length) { // Get the trusted audio interface which will give us the handles. - const PPB_AudioTrusted_Dev* audio_trusted = - reinterpret_cast<const PPB_AudioTrusted_Dev*>( - dispatcher()->GetLocalInterface(PPB_AUDIO_TRUSTED_DEV_INTERFACE)); + const PPB_AudioTrusted* audio_trusted = + reinterpret_cast<const PPB_AudioTrusted*>( + dispatcher()->GetLocalInterface(PPB_AUDIO_TRUSTED_INTERFACE)); if (!audio_trusted) return PP_ERROR_NOINTERFACE; diff --git a/ppapi/proxy/ppb_audio_proxy.h b/ppapi/proxy/ppb_audio_proxy.h index a8dc748..c77e3d6 100644 --- a/ppapi/proxy/ppb_audio_proxy.h +++ b/ppapi/proxy/ppb_audio_proxy.h @@ -16,7 +16,7 @@ #include "ppapi/proxy/interface_proxy.h" #include "ppapi/proxy/proxy_non_thread_safe_ref_count.h" -struct PPB_Audio_Dev; +struct PPB_Audio; namespace pp { namespace proxy { @@ -26,8 +26,8 @@ class PPB_Audio_Proxy : public InterfaceProxy { PPB_Audio_Proxy(Dispatcher* dispatcher, const void* target_interface); virtual ~PPB_Audio_Proxy(); - const PPB_Audio_Dev* ppb_audio_target() const { - return static_cast<const PPB_Audio_Dev*>(target_interface()); + const PPB_Audio* ppb_audio_target() const { + return static_cast<const PPB_Audio*>(target_interface()); } // InterfaceProxy implementation. |