summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2009-11-04 08:27:26 -0800
committerEric Laurent <elaurent@google.com>2009-11-04 23:47:21 -0800
commitbda7469d9b1ec6d9c9d6da40ddf64dc39ff271a9 (patch)
treeb89b73e6feeadefb4ad958c0359789cf0ae5b90f /include
parente1e0dc8e6eaec052ebb6b88f5b1223075ce5a356 (diff)
downloadframeworks_base-bda7469d9b1ec6d9c9d6da40ddf64dc39ff271a9.zip
frameworks_base-bda7469d9b1ec6d9c9d6da40ddf64dc39ff271a9.tar.gz
frameworks_base-bda7469d9b1ec6d9c9d6da40ddf64dc39ff271a9.tar.bz2
Fix issue 2203561: Sholes: audio playing out of earpiece.
Create a new IAudioTrack interface to AudioFlinger when start() fails due to a broken pipe error. Do the same if start fails due to the same error after time out in obtainBuffer(). Do not indicate that the AudioTrack is started to AudioPolicyManager if IAudioTrack start fails. This avoids that an AudioTrack keeps a dead IAudioTrack after a media server crash. Same modifications for AudioRecord. Add a flag to ToneGenerator indicating that the callback thread can call Java. Without it, when the media server crashes and restarts, the AudioSystem error callback will crash in JNI if the IAudiotrack is created from AudioTrack callback thread.
Diffstat (limited to 'include')
-rw-r--r--include/media/AudioRecord.h6
-rw-r--r--include/media/AudioTrack.h8
-rw-r--r--include/media/ToneGenerator.h3
3 files changed, 16 insertions, 1 deletions
diff --git a/include/media/AudioRecord.h b/include/media/AudioRecord.h
index 503cb31..008468c 100644
--- a/include/media/AudioRecord.h
+++ b/include/media/AudioRecord.h
@@ -314,6 +314,11 @@ private:
};
bool processAudioBuffer(const sp<ClientRecordThread>& thread);
+ status_t openRecord(uint32_t sampleRate,
+ int format,
+ int channelCount,
+ int frameCount,
+ uint32_t flags);
sp<IAudioRecord> mAudioRecord;
sp<IMemory> mCblkMemory;
@@ -341,6 +346,7 @@ private:
uint32_t mNewPosition;
uint32_t mUpdatePeriod;
audio_io_handle_t mInput;
+ uint32_t mFlags;
};
}; // namespace android
diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h
index 981c2f6..14b30ae 100644
--- a/include/media/AudioTrack.h
+++ b/include/media/AudioTrack.h
@@ -391,6 +391,14 @@ private:
};
bool processAudioBuffer(const sp<AudioTrackThread>& thread);
+ status_t createTrack(int streamType,
+ uint32_t sampleRate,
+ int format,
+ int channelCount,
+ int frameCount,
+ uint32_t flags,
+ const sp<IMemory>& sharedBuffer,
+ audio_io_handle_t output);
sp<IAudioTrack> mAudioTrack;
sp<IMemory> mCblkMemory;
diff --git a/include/media/ToneGenerator.h b/include/media/ToneGenerator.h
index c884c2c..1ad1f26 100644
--- a/include/media/ToneGenerator.h
+++ b/include/media/ToneGenerator.h
@@ -151,7 +151,7 @@ public:
NUM_SUP_TONES = LAST_SUP_TONE-FIRST_SUP_TONE+1
};
- ToneGenerator(int streamType, float volume);
+ ToneGenerator(int streamType, float volume, bool threadCanCallJava = false);
~ToneGenerator();
bool startTone(int toneType, int durationMs = -1);
@@ -242,6 +242,7 @@ private:
static const ToneDescriptor sToneDescriptors[];
+ bool mThreadCanCallJava;
unsigned int mTotalSmp; // Total number of audio samples played (gives current time)
unsigned int mNextSegSmp; // Position of next segment transition expressed in samples
// NOTE: because mTotalSmp, mNextSegSmp are stored on 32 bit, current design will operate properly