Chromium Code Reviews| Index: webrtc/modules/audio_device/android/opensles_common.cc |
| diff --git a/webrtc/modules/audio_device/android/opensles_common.cc b/webrtc/modules/audio_device/android/opensles_common.cc |
| index da1e25483c93ea8607a185731a04736ef3725c1b..31dcd503ddde8988a3aa7f96200b016fb854579a 100644 |
| --- a/webrtc/modules/audio_device/android/opensles_common.cc |
| +++ b/webrtc/modules/audio_device/android/opensles_common.cc |
| @@ -11,13 +11,44 @@ |
| #include "webrtc/modules/audio_device/android/opensles_common.h" |
| #include <assert.h> |
| +#include <SLES/OpenSLES.h> |
| +#include "webrtc/base/arraysize.h" |
| #include "webrtc/modules/audio_device/android/audio_common.h" |
| using webrtc::kNumChannels; |
| namespace webrtc { |
| +// Returns a string representation given an integer SL_RESULT_XXX code. |
| +// The mapping can be found in <SLES/OpenSLES.h>. |
| +const char* GetSLErrorString(size_t code) { |
| + const char* sl_error_strings[] = { |
|
magjed_webrtc
2016/05/31 11:24:07
Make this variable static.
henrika_webrtc
2016/05/31 12:04:03
Done.
|
| + "SL_RESULT_SUCCESS", // 0 |
| + "SL_RESULT_PRECONDITIONS_VIOLATED", // 1 |
| + "SL_RESULT_PARAMETER_INVALID", // 2 |
| + "SL_RESULT_MEMORY_FAILURE", // 3 |
| + "SL_RESULT_RESOURCE_ERROR", // 4 |
| + "SL_RESULT_RESOURCE_LOST", // 5 |
| + "SL_RESULT_IO_ERROR", // 6 |
| + "SL_RESULT_BUFFER_INSUFFICIENT", // 7 |
| + "SL_RESULT_CONTENT_CORRUPTED", // 8 |
| + "SL_RESULT_CONTENT_UNSUPPORTED", // 9 |
| + "SL_RESULT_CONTENT_NOT_FOUND", // 10 |
| + "SL_RESULT_PERMISSION_DENIED", // 11 |
| + "SL_RESULT_FEATURE_UNSUPPORTED", // 12 |
| + "SL_RESULT_INTERNAL_ERROR", // 13 |
| + "SL_RESULT_UNKNOWN_ERROR", // 14 |
| + "SL_RESULT_OPERATION_ABORTED", // 15 |
| + "SL_RESULT_CONTROL_LOST", // 16 |
| + }; |
| + |
| + if (code >= arraysize(sl_error_strings)) { |
| + return "SL_RESULT_UNKNOWN_ERROR"; |
| + } |
| + return sl_error_strings[code]; |
| +} |
| + |
| SLDataFormat_PCM CreatePcmConfiguration(int sample_rate) { |
| SLDataFormat_PCM configuration; |
| configuration.formatType = SL_DATAFORMAT_PCM; |