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

Unified Diff: media/audio/android/opensles_util.h

Issue 9655023: Adding input and output audio backend to Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased && addressed qinmin's comments Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: media/audio/android/opensles_util.h
diff --git a/media/audio/android/opensles_util.h b/media/audio/android/opensles_util.h
new file mode 100644
index 0000000000000000000000000000000000000000..53b544f99ded1d547390fa20c2260b787cea7854
--- /dev/null
+++ b/media/audio/android/opensles_util.h
@@ -0,0 +1,44 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_AUDIO_OPENSLES_UTIL_H_
qinmin 2012/04/02 13:28:54 missing ANDROID
no longer working on chromium 2012/04/02 15:17:38 Sorry, I missed this in the previous set. Done no
+#define MEDIA_AUDIO_OPENSLES_UTIL_H_
qinmin 2012/04/02 13:28:54 this too
no longer working on chromium 2012/04/02 15:17:38 Done.
+
+#include "base/logging.h"
+#include <SLES/OpenSLES.h>
+
+namespace media {
+
+template <typename SLType, typename SLDerefType>
+class ScopedSLObject {
+ public:
+ ScopedSLObject() : obj_(NULL) {}
+
+ ~ScopedSLObject() { Reset(); }
+
+ SLType* Receive() {
+ DCHECK(!obj_);
+ return &obj_;
+ }
+
+ SLDerefType operator->() { return *obj_; }
+
+ SLType Get() const { return obj_; }
+
+ void Reset() {
+ if (obj_) {
+ (*obj_)->Destroy(obj_);
+ obj_ = NULL;
+ }
+ }
+
+ private:
+ SLType obj_;
+};
+
+typedef ScopedSLObject<SLObjectItf, const SLObjectItf_*> ScopedSLObjectItf;
+
+} // namespace media
+
+#endif // MEDIA_AUDIO_OPENSLES_UTIL_H_
qinmin 2012/04/02 13:28:54 same here
no longer working on chromium 2012/04/02 15:17:38 Done.

Powered by Google App Engine
This is Rietveld 408576698