OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_OPENSLES_COMMON_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_OPENSLES_COMMON_H_ |
12 #define WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_OPENSLES_COMMON_H_ | 12 #define WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_OPENSLES_COMMON_H_ |
13 | 13 |
14 #include <SLES/OpenSLES.h> | 14 #include <SLES/OpenSLES.h> |
15 | 15 |
16 #include "webrtc/base/checks.h" | 16 #include "webrtc/base/checks.h" |
17 | 17 |
18 namespace webrtc { | 18 namespace webrtc { |
19 | 19 |
| 20 // Returns a string representation given an integer SL_RESULT_XXX code. |
| 21 // The mapping can be found in <SLES/OpenSLES.h>. |
| 22 const char* GetSLErrorString(size_t code); |
| 23 |
20 SLDataFormat_PCM CreatePcmConfiguration(int sample_rate); | 24 SLDataFormat_PCM CreatePcmConfiguration(int sample_rate); |
21 | 25 |
22 // Helper class for using SLObjectItf interfaces. | 26 // Helper class for using SLObjectItf interfaces. |
23 template <typename SLType, typename SLDerefType> | 27 template <typename SLType, typename SLDerefType> |
24 class ScopedSLObject { | 28 class ScopedSLObject { |
25 public: | 29 public: |
26 ScopedSLObject() : obj_(nullptr) {} | 30 ScopedSLObject() : obj_(nullptr) {} |
27 | 31 |
28 ~ScopedSLObject() { Reset(); } | 32 ~ScopedSLObject() { Reset(); } |
29 | 33 |
(...skipping 15 matching lines...) Expand all Loading... |
45 | 49 |
46 private: | 50 private: |
47 SLType obj_; | 51 SLType obj_; |
48 }; | 52 }; |
49 | 53 |
50 typedef ScopedSLObject<SLObjectItf, const SLObjectItf_*> ScopedSLObjectItf; | 54 typedef ScopedSLObject<SLObjectItf, const SLObjectItf_*> ScopedSLObjectItf; |
51 | 55 |
52 } // namespace webrtc_opensl | 56 } // namespace webrtc_opensl |
53 | 57 |
54 #endif // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_OPENSLES_COMMON_H_ | 58 #endif // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_OPENSLES_COMMON_H_ |
OLD | NEW |