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

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

Issue 131503006: Initialization of audio manager for Android is now done on the audio thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed bad getter in unit test Created 6 years, 10 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/audio_manager_android.h
diff --git a/media/audio/android/audio_manager_android.h b/media/audio/android/audio_manager_android.h
index ac67d08603f2035b0fd7047b0bee53f543ba9a5b..7834534302092faca282ac4f5bb28ad1f37c8cff 100644
--- a/media/audio/android/audio_manager_android.h
+++ b/media/audio/android/audio_manager_android.h
@@ -9,7 +9,9 @@
#include "base/android/jni_android.h"
#include "base/gtest_prod_util.h"
+#include "base/message_loop/message_loop.h"
#include "base/synchronization/lock.h"
+#include "base/synchronization/waitable_event.h"
#include "media/audio/audio_manager_base.h"
namespace media {
@@ -17,7 +19,9 @@ namespace media {
class OpenSLESOutputStream;
// Android implemention of AudioManager.
-class MEDIA_EXPORT AudioManagerAndroid : public AudioManagerBase {
+class MEDIA_EXPORT AudioManagerAndroid
+ : public AudioManagerBase,
+ public base::MessageLoop::DestructionObserver {
public:
AudioManagerAndroid(AudioLogFactory* audio_log_factory);
@@ -65,7 +69,13 @@ class MEDIA_EXPORT AudioManagerAndroid : public AudioManagerBase {
const AudioParameters& input_params) OVERRIDE;
private:
- bool HadNoAudioStreams();
+ // Implementation of MessageLoop::DestructionObserver.
+ virtual void WillDestroyCurrentMessageLoop() OVERRIDE;
+
+ void CreateAndInitOnAudioThread();
+ void CloseOnAudioThread();
+
+ bool HasNoAudioStreams();
void Init();
void Close();
void SetCommunicationAudioModeOn(bool on);
@@ -77,18 +87,11 @@ class MEDIA_EXPORT AudioManagerAndroid : public AudioManagerBase {
void DoSetMuteOnAudioThread(bool muted);
- // Allow the AudioAndroidTest to access private methods.
- FRIEND_TEST_ALL_PREFIXES(AudioAndroidOutputTest, IsAudioLowLatencySupported);
-
// Java AudioManager instance.
base::android::ScopedJavaGlobalRef<jobject> j_audio_manager_;
typedef std::set<OpenSLESOutputStream*> OutputStreams;
OutputStreams streams_;
- // TODO(wjia): remove this lock once unit test modules are fixed to call
- // AudioManager::MakeAudioOutputStream on the audio thread. For now, this
- // lock is used to guard access to |streams_|.
- base::Lock streams_lock_;
DISALLOW_COPY_AND_ASSIGN(AudioManagerAndroid);
};

Powered by Google App Engine
This is Rietveld 408576698