| Index: ppapi/thunk/ppb_audio_config_thunk.cc
|
| ===================================================================
|
| --- ppapi/thunk/ppb_audio_config_thunk.cc (revision 118765)
|
| +++ ppapi/thunk/ppb_audio_config_thunk.cc (working copy)
|
| @@ -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,10 +23,10 @@
|
| 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.
|
| +uint32_t RecommendSampleFrameCount_1_0(PP_AudioSampleRate sample_rate,
|
| + uint32_t requested_sample_frame_count) {
|
| + // Version 1.0: Don't actually query to get a value from the
|
| + // hardware; instead return the input for in-range values.
|
| if (requested_sample_frame_count < PP_AUDIOMINSAMPLEFRAMECOUNT)
|
| return PP_AUDIOMINSAMPLEFRAMECOUNT;
|
| if (requested_sample_frame_count > PP_AUDIOMAXSAMPLEFRAMECOUNT)
|
| @@ -33,6 +34,17 @@
|
| return 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(
|
| + 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,19 +64,40 @@
|
| 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
|
| } // namespace ppapi
|
|
|