Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_audio_config.cc

Issue 9129007: Work on improving PpbAudioConfig:RecommendSampleFrameCount (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "native_client/src/shared/ppapi_proxy/plugin_ppb_audio_config.h" 5 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_audio_config.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 #include <string.h> 8 #include <string.h>
9 #include "srpcgen/ppb_rpc.h" 9 #include "srpcgen/ppb_rpc.h"
10 #include "native_client/src/include/portability.h" 10 #include "native_client/src/include/portability.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 config, 44 config,
45 &sample_frame_count); 45 &sample_frame_count);
46 DebugPrintf("PPB_AudioConfig::GetSampleFrameCount: %s\n", 46 DebugPrintf("PPB_AudioConfig::GetSampleFrameCount: %s\n",
47 NaClSrpcErrorString(srpc_result)); 47 NaClSrpcErrorString(srpc_result));
48 if (NACL_SRPC_RESULT_OK == srpc_result) { 48 if (NACL_SRPC_RESULT_OK == srpc_result) {
49 return static_cast<uint32_t>(sample_frame_count); 49 return static_cast<uint32_t>(sample_frame_count);
50 } 50 }
51 return 0; 51 return 0;
52 } 52 }
53 53
54 uint32_t RecommendSampleFrameCount(PP_AudioSampleRate sample_rate, 54 uint32_t RecommendSampleFrameCount_1_0(PP_AudioSampleRate sample_rate,
55 uint32_t request_sample_frame_count) {
56 DebugPrintf("PPB_AudioConfig::RecommendSampleFrameCount_1_0");
57 int32_t out_sample_frame_count;
58 NaClSrpcError srpc_result =
59 PpbAudioConfigRpcClient::PPB_AudioConfig_RecommendSampleFrameCount_1_0(
60 GetMainSrpcChannel(),
61 static_cast<int32_t>(sample_rate),
62 static_cast<int32_t>(request_sample_frame_count),
63 &out_sample_frame_count);
64 DebugPrintf("PPB_AudioConfig::RecommendSampleFrameCount_1_0: %s\n",
65 NaClSrpcErrorString(srpc_result));
66 if (NACL_SRPC_RESULT_OK == srpc_result) {
67 return static_cast<uint32_t>(out_sample_frame_count);
68 }
69 return 0;
70 }
71
72 uint32_t RecommendSampleFrameCount(PP_Instance instance,
73 PP_AudioSampleRate sample_rate,
55 uint32_t request_sample_frame_count) { 74 uint32_t request_sample_frame_count) {
56 DebugPrintf("PPB_AudioConfig::RecommendSampleFrameCount"); 75 DebugPrintf("PPB_AudioConfig::RecommendSampleFrameCount");
57 int32_t out_sample_frame_count; 76 int32_t out_sample_frame_count;
58 NaClSrpcError srpc_result = 77 NaClSrpcError srpc_result =
59 PpbAudioConfigRpcClient::PPB_AudioConfig_RecommendSampleFrameCount( 78 PpbAudioConfigRpcClient::PPB_AudioConfig_RecommendSampleFrameCount(
60 GetMainSrpcChannel(), 79 GetMainSrpcChannel(),
80 instance,
61 static_cast<int32_t>(sample_rate), 81 static_cast<int32_t>(sample_rate),
62 static_cast<int32_t>(request_sample_frame_count), 82 static_cast<int32_t>(request_sample_frame_count),
63 &out_sample_frame_count); 83 &out_sample_frame_count);
64 DebugPrintf("PPB_AudioConfig::RecommendSampleFrameCount: %s\n", 84 DebugPrintf("PPB_AudioConfig::RecommendSampleFrameCount: %s\n",
65 NaClSrpcErrorString(srpc_result)); 85 NaClSrpcErrorString(srpc_result));
66 if (NACL_SRPC_RESULT_OK == srpc_result) { 86 if (NACL_SRPC_RESULT_OK == srpc_result) {
67 return static_cast<uint32_t>(out_sample_frame_count); 87 return static_cast<uint32_t>(out_sample_frame_count);
68 } 88 }
69 return 0; 89 return 0;
70 } 90 }
(...skipping 28 matching lines...) Expand all
99 static_cast<int32_t>(sample_rate), 119 static_cast<int32_t>(sample_rate),
100 static_cast<int32_t>(sample_frame_count), 120 static_cast<int32_t>(sample_frame_count),
101 &resource); 121 &resource);
102 DebugPrintf("PPB_AudioConfig::CreateStereo16Bit: %s\n", 122 DebugPrintf("PPB_AudioConfig::CreateStereo16Bit: %s\n",
103 NaClSrpcErrorString(srpc_result)); 123 NaClSrpcErrorString(srpc_result));
104 if (NACL_SRPC_RESULT_OK == srpc_result) { 124 if (NACL_SRPC_RESULT_OK == srpc_result) {
105 return resource; 125 return resource;
106 } 126 }
107 return kInvalidResourceId; 127 return kInvalidResourceId;
108 } 128 }
129
130 PP_AudioSampleRate RecommendSampleRate(PP_Instance instance) {
131 DebugPrintf("PPB_AudioConfig::RecommendSampleRate");
132 int32_t out_sample_rate;
133 NaClSrpcError srpc_result =
134 PpbAudioConfigRpcClient::PPB_AudioConfig_RecommendSampleRate(
135 GetMainSrpcChannel(),
136 instance,
137 &out_sample_rate);
138 DebugPrintf("PPB_AudioConfig::RecommendSampleRate: %s\n",
139 NaClSrpcErrorString(srpc_result));
140 if (NACL_SRPC_RESULT_OK == srpc_result) {
141 return static_cast<PP_AudioSampleRate>(out_sample_rate);
142 }
143 return PP_AUDIOSAMPLERATE_NONE;
144 }
145
109 } // namespace 146 } // namespace
110 147
111 const PPB_AudioConfig* PluginAudioConfig::GetInterface() { 148 const PPB_AudioConfig* PluginAudioConfig::GetInterface() {
112 static const PPB_AudioConfig audio_config_interface = { 149 static const PPB_AudioConfig audio_config_interface = {
113 CreateStereo16Bit, 150 CreateStereo16Bit,
114 RecommendSampleFrameCount, 151 RecommendSampleFrameCount,
115 IsAudioConfig, 152 IsAudioConfig,
116 GetSampleRate, 153 GetSampleRate,
117 GetSampleFrameCount, 154 GetSampleFrameCount,
155 RecommendSampleRate
118 }; 156 };
119 return &audio_config_interface; 157 return &audio_config_interface;
120 } 158 }
159
160 const PPB_AudioConfig_1_0* PluginAudioConfig::GetInterface1_0() {
161 static const PPB_AudioConfig_1_0 audio_config_interface = {
162 CreateStereo16Bit,
163 RecommendSampleFrameCount_1_0,
164 IsAudioConfig,
165 GetSampleRate,
166 GetSampleFrameCount
167 };
168 return &audio_config_interface;
169 }
170
121 } // namespace ppapi_proxy 171 } // namespace ppapi_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698