summaryrefslogtreecommitdiffstats
path: root/ppapi/thunk
diff options
context:
space:
mode:
authornfullagar@google.com <nfullagar@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-18 01:10:19 +0000
committernfullagar@google.com <nfullagar@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-18 01:10:19 +0000
commitc59ed589fde8d4c9225b7b1b125286f842a42e56 (patch)
treefdaa00c2a9f51d0030e3b05bb289630ad5f2e211 /ppapi/thunk
parent86bd8a2b5e1ce2965551271109be51244d2fcb42 (diff)
downloadchromium_src-c59ed589fde8d4c9225b7b1b125286f842a42e56.zip
chromium_src-c59ed589fde8d4c9225b7b1b125286f842a42e56.tar.gz
chromium_src-c59ed589fde8d4c9225b7b1b125286f842a42e56.tar.bz2
Work on improving PpbAudioConfig:RecommendSampleFrameCount
Add version 1.1 which will query the audio back end for the best available sample frame count. Also add RecommendSampleRate. Switch pepper plugin delegate to use AUDIO_PCM_LOW_LATENCY if client request is compatible. TEST=included BUG=http://code.google.com/p/chromium/issues/detail?id=107572 Review URL: https://chromiumcodereview.appspot.com/9129007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122653 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/thunk')
-rw-r--r--ppapi/thunk/interfaces_ppb_public_stable.h1
-rw-r--r--ppapi/thunk/ppb_audio_config_thunk.cc52
-rw-r--r--ppapi/thunk/ppb_instance_api.h5
3 files changed, 46 insertions, 12 deletions
diff --git a/ppapi/thunk/interfaces_ppb_public_stable.h b/ppapi/thunk/interfaces_ppb_public_stable.h
index 5bf22de..d8a3f03 100644
--- a/ppapi/thunk/interfaces_ppb_public_stable.h
+++ b/ppapi/thunk/interfaces_ppb_public_stable.h
@@ -49,6 +49,7 @@ PROXIED_API(PPB_URLResponseInfo)
PROXIED_IFACE(PPB_Audio, PPB_AUDIO_INTERFACE_1_0, PPB_Audio_1_0)
// This has no corresponding _Proxy object since it does no IPC.
PROXIED_IFACE(NoAPIName, PPB_AUDIO_CONFIG_INTERFACE_1_0, PPB_AudioConfig_1_0)
+PROXIED_IFACE(NoAPIName, PPB_AUDIO_CONFIG_INTERFACE_1_1, PPB_AudioConfig_1_1)
// Note: Core is special and is registered manually.
PROXIED_IFACE(PPB_FileIO, PPB_FILEIO_INTERFACE_1_0, PPB_FileIO_1_0)
PROXIED_IFACE(PPB_FileRef, PPB_FILEREF_INTERFACE_1_0, PPB_FileRef_1_0)
diff --git a/ppapi/thunk/ppb_audio_config_thunk.cc b/ppapi/thunk/ppb_audio_config_thunk.cc
index 2cc82a3..123d148 100644
--- a/ppapi/thunk/ppb_audio_config_thunk.cc
+++ b/ppapi/thunk/ppb_audio_config_thunk.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "ppapi/shared_impl/ppb_audio_config_shared.h"
#include "ppapi/thunk/thunk.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/ppb_audio_config_api.h"
@@ -22,17 +23,23 @@ PP_Resource CreateStereo16bit(PP_Instance instance,
sample_frame_count);
}
-uint32_t RecommendSampleFrameCount(PP_AudioSampleRate sample_rate,
- uint32_t requested_sample_frame_count) {
- // TODO(brettw) Currently we don't actually query to get a value from the
- // hardware, so we always return the input for in-range values.
- if (requested_sample_frame_count < PP_AUDIOMINSAMPLEFRAMECOUNT)
- return PP_AUDIOMINSAMPLEFRAMECOUNT;
- if (requested_sample_frame_count > PP_AUDIOMAXSAMPLEFRAMECOUNT)
- return PP_AUDIOMAXSAMPLEFRAMECOUNT;
- return requested_sample_frame_count;
+uint32_t RecommendSampleFrameCount_1_0(PP_AudioSampleRate sample_rate,
+ uint32_t requested_sample_frame_count) {
+ return PPB_AudioConfig_Shared::RecommendSampleFrameCount_1_0(sample_rate,
+ requested_sample_frame_count);
}
+uint32_t RecommendSampleFrameCount_1_1(PP_Instance instance,
+ PP_AudioSampleRate sample_rate,
+ uint32_t requested_sample_frame_count) {
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return 0;
+ return PPB_AudioConfig_Shared::RecommendSampleFrameCount_1_1(instance,
+ sample_rate, requested_sample_frame_count);
+}
+
+
PP_Bool IsAudioConfig(PP_Resource resource) {
EnterResource<PPB_AudioConfig_API> enter(resource, false);
return PP_FromBool(enter.succeeded());
@@ -52,18 +59,39 @@ uint32_t GetSampleFrameCount(PP_Resource config_id) {
return enter.object()->GetSampleFrameCount();
}
-const PPB_AudioConfig g_ppb_audio_config_thunk = {
+PP_AudioSampleRate RecommendSampleRate(PP_Instance instance) {
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return PP_AUDIOSAMPLERATE_NONE;
+ return PPB_AudioConfig_Shared::RecommendSampleRate(instance);
+}
+
+const PPB_AudioConfig_1_0 g_ppb_audio_config_thunk_1_0 = {
&CreateStereo16bit,
- &RecommendSampleFrameCount,
+ &RecommendSampleFrameCount_1_0,
&IsAudioConfig,
&GetSampleRate,
&GetSampleFrameCount
};
+const PPB_AudioConfig_1_1 g_ppb_audio_config_thunk_1_1 = {
+ &CreateStereo16bit,
+ &RecommendSampleFrameCount_1_1,
+ &IsAudioConfig,
+ &GetSampleRate,
+ &GetSampleFrameCount,
+ &RecommendSampleRate
+};
+
+
} // namespace
const PPB_AudioConfig_1_0* GetPPB_AudioConfig_1_0_Thunk() {
- return &g_ppb_audio_config_thunk;
+ return &g_ppb_audio_config_thunk_1_0;
+}
+
+const PPB_AudioConfig_1_1* GetPPB_AudioConfig_1_1_Thunk() {
+ return &g_ppb_audio_config_thunk_1_1;
}
} // namespace thunk
diff --git a/ppapi/thunk/ppb_instance_api.h b/ppapi/thunk/ppb_instance_api.h
index 741f762..3055d73 100644
--- a/ppapi/thunk/ppb_instance_api.h
+++ b/ppapi/thunk/ppb_instance_api.h
@@ -9,6 +9,7 @@
#include "ppapi/c/dev/ppb_gamepad_dev.h"
#include "ppapi/c/dev/ppb_url_util_dev.h"
#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/ppb_audio_config.h"
#include "ppapi/c/ppb_instance.h"
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_size.h"
@@ -43,6 +44,10 @@ class PPB_Instance_FunctionAPI {
PP_Var script,
PP_Var* exception) = 0;
+ // Audio.
+ virtual uint32_t GetAudioHardwareOutputSampleRate(PP_Instance instance) = 0;
+ virtual uint32_t GetAudioHardwareOutputBufferSize(PP_Instance instance) = 0;
+
// CharSet.
virtual PP_Var GetDefaultCharSet(PP_Instance instance) = 0;