summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2013-09-24 11:52:37 -0700
committerGlenn Kasten <gkasten@google.com>2013-09-24 12:12:47 -0700
commite93cf2ca27ae6f4a81d4ef548bbf10a34db6d98f (patch)
tree4de6f04ad4abc14bb0e777bcb02863196c59e34b /services
parent402dfba6dcd68f5fd8d8921f9751f3e47eb1449d (diff)
downloadframeworks_av-e93cf2ca27ae6f4a81d4ef548bbf10a34db6d98f.zip
frameworks_av-e93cf2ca27ae6f4a81d4ef548bbf10a34db6d98f.tar.gz
frameworks_av-e93cf2ca27ae6f4a81d4ef548bbf10a34db6d98f.tar.bz2
Cleanup openRecord error handling
Bug: 10888816 Change-Id: I84897dd7d30b370640b54e928f230604b873cb68
Diffstat (limited to 'services')
-rw-r--r--services/audioflinger/AudioFlinger.cpp4
-rw-r--r--services/audioflinger/Threads.cpp4
2 files changed, 7 insertions, 1 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index f6e4c6a..b8f2d0d 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -1242,6 +1242,7 @@ sp<IAudioRecord> AudioFlinger::openRecord(
// check calling permissions
if (!recordingAllowed()) {
+ ALOGE("openRecord() permission denied: recording not allowed");
lStatus = PERMISSION_DENIED;
goto Exit;
}
@@ -1257,12 +1258,14 @@ sp<IAudioRecord> AudioFlinger::openRecord(
Mutex::Autolock _l(mLock);
thread = checkRecordThread_l(input);
if (thread == NULL) {
+ ALOGE("openRecord() checkRecordThread_l failed");
lStatus = BAD_VALUE;
goto Exit;
}
if (deviceRequiresCaptureAudioOutputPermission(thread->inDevice())
&& !captureAudioOutputAllowed()) {
+ ALOGE("openRecord() permission denied: capture not allowed");
lStatus = PERMISSION_DENIED;
goto Exit;
}
@@ -1283,6 +1286,7 @@ sp<IAudioRecord> AudioFlinger::openRecord(
// The record track uses one track in mHardwareMixerThread by convention.
recordTrack = thread->createRecordTrack_l(client, sampleRate, format, channelMask,
frameCount, lSessionId, flags, tid, &lStatus);
+ LOG_ALWAYS_FATAL_IF((recordTrack != 0) != (lStatus == NO_ERROR));
}
if (lStatus != NO_ERROR) {
// remove local strong reference to Client before deleting the RecordTrack so that the
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 5f36cab..cba9ad1 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -4548,7 +4548,7 @@ sp<AudioFlinger::RecordThread::RecordTrack> AudioFlinger::RecordThread::createR
lStatus = initCheck();
if (lStatus != NO_ERROR) {
- ALOGE("Audio driver not initialized.");
+ ALOGE("createRecordTrack_l() audio driver not initialized");
goto Exit;
}
@@ -4612,7 +4612,9 @@ sp<AudioFlinger::RecordThread::RecordTrack> AudioFlinger::RecordThread::createR
format, channelMask, frameCount, sessionId);
if (track->getCblk() == 0) {
+ ALOGE("createRecordTrack_l() no control block");
lStatus = NO_MEMORY;
+ track.clear();
goto Exit;
}
mTracks.add(track);