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

Unified Diff: webrtc/modules/audio_device/android/opensles_player.h

Issue 2019223004: Moves ownership of OpenSL engine object to Android audio manager (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Feedback from magjed@ Created 4 years, 7 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: webrtc/modules/audio_device/android/opensles_player.h
diff --git a/webrtc/modules/audio_device/android/opensles_player.h b/webrtc/modules/audio_device/android/opensles_player.h
index 4058ff999488dc421a8ec5ae119be8539bb4cded..e3978a19909f7594981bf87423be8956c2c5df45 100644
--- a/webrtc/modules/audio_device/android/opensles_player.h
+++ b/webrtc/modules/audio_device/android/opensles_player.h
@@ -55,12 +55,6 @@ class OpenSLESPlayer {
// audio manager at construction.
static const int kNumOfOpenSLESBuffers = 4;
- // There is no need for this class to use JNI.
- static int32_t SetAndroidAudioDeviceObjects(void* javaVM, void* context) {
- return 0;
- }
- static void ClearAndroidAudioDeviceObjects() {}
-
explicit OpenSLESPlayer(AudioManager* audio_manager);
~OpenSLESPlayer();
@@ -103,9 +97,10 @@ class OpenSLESPlayer {
// via the SLAndroidSimpleBufferQueueItf interface.
void AllocateDataBuffers();
- // Creates/destroys the main engine object and the SLEngineItf interface.
- bool CreateEngine();
- void DestroyEngine();
+ // Obtaines the SL Engine Interface from the existing global Engine object.
+ // The interface exposes creation methods of all the OpenSL ES object types.
+ // This method defines the |engine_| member variable.
+ bool ObtainEngineInterface();
// Creates/destroys the output mix object.
bool CreateMix();
@@ -127,6 +122,12 @@ class OpenSLESPlayer {
// Detached during construction of this object.
rtc::ThreadChecker thread_checker_opensles_;
+ // Raw pointer to the audio manager injected at construction. Used to cache
+ // audio parameters and to access the global SL engine object needed by the
+ // ObtainEngineInterface() method. The audio manager outlives any instance of
+ // this class.
+ AudioManager* audio_manager_;
+
// Contains audio parameters provided to this class at construction by the
// AudioManager.
const AudioParameters audio_parameters_;
@@ -169,10 +170,6 @@ class OpenSLESPlayer {
// Example (kNumOfOpenSLESBuffers = 2): counts 0, 1, 0, 1, ...
int buffer_index_;
- // The engine object which provides the SLEngineItf interface.
- // Created by the global Open SL ES constructor slCreateEngine().
- webrtc::ScopedSLObjectItf engine_object_;
-
// This interface exposes creation methods for all the OpenSL ES object types.
// It is the OpenSL ES API entry point.
SLEngineItf engine_;
« no previous file with comments | « webrtc/modules/audio_device/android/opensles_common.cc ('k') | webrtc/modules/audio_device/android/opensles_player.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698