summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2012-05-08 18:57:51 -0700
committerEric Laurent <elaurent@google.com>2012-05-14 17:20:12 -0700
commit2986460984580833161bdaabc7f17da1005a8961 (patch)
treebd8aa210c0faee61dc45e23479e29cfc85f313c2 /media
parentdfa29ab13647f22b30b2de34d4830c9e815bf120 (diff)
downloadframeworks_av-2986460984580833161bdaabc7f17da1005a8961.zip
frameworks_av-2986460984580833161bdaabc7f17da1005a8961.tar.gz
frameworks_av-2986460984580833161bdaabc7f17da1005a8961.tar.bz2
Fix issues with synchronous record start.
- Added a timeout in case the trigger event is never fired. - Extend AudioRecord obtainBuffer() timeout in case of synchronous start to avoid spurious warning. - Make sure that the event is triggered if the track is destroyed. - Reject event if the triggering track is in an incompatible state. Also fix a problem when restoring a static AudioTrack after a mediaserver crash. Bug 6449468. Change-Id: Ib36e11111fb88f73caa31dcb0622792737d57a4b
Diffstat (limited to 'media')
-rw-r--r--media/libmedia/AudioRecord.cpp5
-rw-r--r--media/libmedia/AudioTrack.cpp3
2 files changed, 7 insertions, 1 deletions
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp
index c21979b..0562f8e 100644
--- a/media/libmedia/AudioRecord.cpp
+++ b/media/libmedia/AudioRecord.cpp
@@ -334,7 +334,8 @@ status_t AudioRecord::start(AudioSystem::sync_event_t event, int triggerSession)
cblk->lock.unlock();
if (ret == NO_ERROR) {
mNewPosition = cblk->user + mUpdatePeriod;
- cblk->bufferTimeoutMs = MAX_RUN_TIMEOUT_MS;
+ cblk->bufferTimeoutMs = (event == AudioSystem::SYNC_EVENT_NONE) ? MAX_RUN_TIMEOUT_MS :
+ AudioSystem::kSyncRecordStartTimeOutMs;
cblk->waitTimeMs = 0;
if (t != 0) {
// thread unblocks in readyToRun() and returns NO_ERROR
@@ -569,6 +570,8 @@ create_new_record:
}
cblk->waitTimeMs = 0;
+ // reset time out to running value after obtaining a buffer
+ cblk->bufferTimeoutMs = MAX_RUN_TIMEOUT_MS;
if (framesReq > framesReady) {
framesReq = framesReady;
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index 6189be5..5e6cd51 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -1365,6 +1365,9 @@ status_t AudioTrack::restoreTrack_l(audio_track_cblk_t*& cblk, bool fromStart)
mCblk->stepUser(frames);
}
}
+ if (mSharedBuffer != 0) {
+ mCblk->stepUser(mCblk->frameCount);
+ }
if (mActive) {
result = mAudioTrack->start();
ALOGW_IF(result != NO_ERROR, "restoreTrack_l() start() failed status %d", result);