| Index: media/audio/android/opensles_output.h
|
| diff --git a/media/audio/android/opensles_output.h b/media/audio/android/opensles_output.h
|
| index 671dbdec4a337c0a28856a08955b2f3b7daefae5..80d8929769a68f7cd46ed1afeef117ff5838346d 100644
|
| --- a/media/audio/android/opensles_output.h
|
| +++ b/media/audio/android/opensles_output.h
|
| @@ -21,6 +21,25 @@
|
| #include "media/base/audio_parameters.h"
|
| #include "media/base/audio_timestamp_helper.h"
|
|
|
| +// On L+, we want to use floating point output for better fidelity.
|
| +#if __ANDROID_API__ < 21
|
| +#define SL_ANDROID_PCM_REPRESENTATION_SIGNED_INT ((SLuint32)0x00000001)
|
| +#define SL_ANDROID_PCM_REPRESENTATION_UNSIGNED_INT ((SLuint32)0x00000002)
|
| +#define SL_ANDROID_PCM_REPRESENTATION_FLOAT ((SLuint32)0x00000003)
|
| +#define SL_ANDROID_DATAFORMAT_PCM_EX ((SLuint32)0x00000004)
|
| +
|
| +typedef struct SLAndroidDataFormat_PCM_EX_ {
|
| + SLuint32 formatType;
|
| + SLuint32 numChannels;
|
| + SLuint32 sampleRate;
|
| + SLuint32 bitsPerSample;
|
| + SLuint32 containerSize;
|
| + SLuint32 channelMask;
|
| + SLuint32 endianness;
|
| + SLuint32 representation;
|
| +} SLAndroidDataFormat_PCM_EX;
|
| +#endif
|
| +
|
| namespace media {
|
|
|
| class AudioManagerAndroid;
|
| @@ -101,14 +120,13 @@ class OpenSLESOutputStream : public AudioOutputStream {
|
| SLAndroidSimpleBufferQueueItf simple_buffer_queue_;
|
|
|
| SLDataFormat_PCM format_;
|
| + SLAndroidDataFormat_PCM_EX float_format_;
|
|
|
| // Audio buffers that are allocated during Open() based on parameters given
|
| // during construction.
|
| uint8_t* audio_data_[kMaxNumOfBuffersInQueue];
|
|
|
| int active_buffer_index_;
|
| - int bytes_per_frame_;
|
| - size_t buffer_size_bytes_;
|
|
|
| bool started_;
|
|
|
| @@ -123,6 +141,12 @@ class OpenSLESOutputStream : public AudioOutputStream {
|
|
|
| int samples_per_second_;
|
|
|
| + // On Android 5.0+ we can output directly to float instead of in integer.
|
| + bool have_float_output_;
|
| +
|
| + int bytes_per_frame_;
|
| + size_t buffer_size_bytes_;
|
| +
|
| // Used to calculate the delay value for each OnMoreData() call.
|
| AudioTimestampHelper delay_calculator_;
|
|
|
|
|