Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_AUDIO_ANDROID_OPENSLES_OUTPUT_H_ | 5 #ifndef MEDIA_AUDIO_ANDROID_OPENSLES_OUTPUT_H_ |
| 6 #define MEDIA_AUDIO_ANDROID_OPENSLES_OUTPUT_H_ | 6 #define MEDIA_AUDIO_ANDROID_OPENSLES_OUTPUT_H_ |
| 7 | 7 |
| 8 #include <SLES/OpenSLES.h> | 8 #include <SLES/OpenSLES.h> |
| 9 #include <SLES/OpenSLES_Android.h> | 9 #include <SLES/OpenSLES_Android.h> |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 virtual ~OpenSLESOutputStream(); | 33 virtual ~OpenSLESOutputStream(); |
| 34 | 34 |
| 35 // Implementation of AudioOutputStream. | 35 // Implementation of AudioOutputStream. |
| 36 virtual bool Open() OVERRIDE; | 36 virtual bool Open() OVERRIDE; |
| 37 virtual void Close() OVERRIDE; | 37 virtual void Close() OVERRIDE; |
| 38 virtual void Start(AudioSourceCallback* callback) OVERRIDE; | 38 virtual void Start(AudioSourceCallback* callback) OVERRIDE; |
| 39 virtual void Stop() OVERRIDE; | 39 virtual void Stop() OVERRIDE; |
| 40 virtual void SetVolume(double volume) OVERRIDE; | 40 virtual void SetVolume(double volume) OVERRIDE; |
| 41 virtual void GetVolume(double* volume) OVERRIDE; | 41 virtual void GetVolume(double* volume) OVERRIDE; |
| 42 | 42 |
| 43 void SetMute(bool state); | |
|
tommi (sloooow) - chröme
2013/12/02 18:36:00
nit: s/state/muted
wjia(left Chromium)
2013/12/02 21:49:49
Done.
| |
| 44 | |
| 43 private: | 45 private: |
| 44 bool CreatePlayer(); | 46 bool CreatePlayer(); |
| 45 | 47 |
| 46 // Called from OpenSLES specific audio worker thread. | 48 // Called from OpenSLES specific audio worker thread. |
| 47 static void SimpleBufferQueueCallback( | 49 static void SimpleBufferQueueCallback( |
| 48 SLAndroidSimpleBufferQueueItf buffer_queue, | 50 SLAndroidSimpleBufferQueueItf buffer_queue, |
| 49 void* instance); | 51 void* instance); |
| 50 | 52 |
| 51 // Fills up one buffer by asking the registered source for data. | 53 // Fills up one buffer by asking the registered source for data. |
| 52 // Called from OpenSLES specific audio worker thread. | 54 // Called from OpenSLES specific audio worker thread. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 | 91 |
| 90 // Audio buffers that are allocated in the constructor based on | 92 // Audio buffers that are allocated in the constructor based on |
| 91 // info from audio parameters. | 93 // info from audio parameters. |
| 92 uint8* audio_data_[kMaxNumOfBuffersInQueue]; | 94 uint8* audio_data_[kMaxNumOfBuffersInQueue]; |
| 93 | 95 |
| 94 int active_buffer_index_; | 96 int active_buffer_index_; |
| 95 size_t buffer_size_bytes_; | 97 size_t buffer_size_bytes_; |
| 96 | 98 |
| 97 bool started_; | 99 bool started_; |
| 98 | 100 |
| 101 // Volume control coming from hardware. It overrides |volume_| when it's | |
| 102 // true. Otherwise, use |volume_| for scaling. | |
| 103 // This is needed because platform voice volume never goes to zero in | |
| 104 // COMMUNICATION mode on Android. | |
| 105 bool muted_; | |
| 106 | |
| 99 // Volume level from 0 to 1. | 107 // Volume level from 0 to 1. |
| 100 float volume_; | 108 float volume_; |
| 101 | 109 |
| 102 // Container for retrieving data from AudioSourceCallback::OnMoreData(). | 110 // Container for retrieving data from AudioSourceCallback::OnMoreData(). |
| 103 scoped_ptr<AudioBus> audio_bus_; | 111 scoped_ptr<AudioBus> audio_bus_; |
| 104 | 112 |
| 105 DISALLOW_COPY_AND_ASSIGN(OpenSLESOutputStream); | 113 DISALLOW_COPY_AND_ASSIGN(OpenSLESOutputStream); |
| 106 }; | 114 }; |
| 107 | 115 |
| 108 } // namespace media | 116 } // namespace media |
| 109 | 117 |
| 110 #endif // MEDIA_AUDIO_ANDROID_OPENSLES_OUTPUT_H_ | 118 #endif // MEDIA_AUDIO_ANDROID_OPENSLES_OUTPUT_H_ |
| OLD | NEW |