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

Side by Side Diff: webrtc/modules/audio_device/android/opensles_common.h

Issue 2119633004: Adds support for OpenSL ES based audio capture on Android (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebased Created 4 years, 3 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
OLDNEW
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 <stddef.h>
14 #include <SLES/OpenSLES.h> 15 #include <SLES/OpenSLES.h>
15 16
16 #include "webrtc/base/checks.h"
17
18 namespace webrtc { 17 namespace webrtc {
19 18
20 // Returns a string representation given an integer SL_RESULT_XXX code. 19 // Returns a string representation given an integer SL_RESULT_XXX code.
21 // The mapping can be found in <SLES/OpenSLES.h>. 20 // The mapping can be found in <SLES/OpenSLES.h>.
22 const char* GetSLErrorString(size_t code); 21 const char* GetSLErrorString(size_t code);
23 22
24 SLDataFormat_PCM CreatePcmConfiguration(int sample_rate); 23 // Configures an SL_DATAFORMAT_PCM structure based on native audio parameters.
24 SLDataFormat_PCM CreatePCMConfiguration(size_t channels,
25 int sample_rate,
26 size_t bits_per_sample);
25 27
26 // Helper class for using SLObjectItf interfaces. 28 // Helper class for using SLObjectItf interfaces.
27 template <typename SLType, typename SLDerefType> 29 template <typename SLType, typename SLDerefType>
28 class ScopedSLObject { 30 class ScopedSLObject {
29 public: 31 public:
30 ScopedSLObject() : obj_(nullptr) {} 32 ScopedSLObject() : obj_(nullptr) {}
31 33
32 ~ScopedSLObject() { Reset(); } 34 ~ScopedSLObject() { Reset(); }
33 35
34 SLType* Receive() { 36 SLType* Receive() {
(...skipping 11 matching lines...) Expand all
46 obj_ = nullptr; 48 obj_ = nullptr;
47 } 49 }
48 } 50 }
49 51
50 private: 52 private:
51 SLType obj_; 53 SLType obj_;
52 }; 54 };
53 55
54 typedef ScopedSLObject<SLObjectItf, const SLObjectItf_*> ScopedSLObjectItf; 56 typedef ScopedSLObject<SLObjectItf, const SLObjectItf_*> ScopedSLObjectItf;
55 57
56 } // namespace webrtc_opensl 58 } // namespace webrtc
57 59
58 #endif // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_OPENSLES_COMMON_H_ 60 #endif // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_OPENSLES_COMMON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698