summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2013-10-07 16:16:06 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-10-07 16:16:06 +0000
commitfee4ce338d78eeb58af1f66831ead53322d3859e (patch)
treef90931a7c5c4628b0e8e47976d68a9d586802b53 /services
parentea0fadeb5d81ef3cb7f9db458c9033d628bdb86a (diff)
parente93cf2ca27ae6f4a81d4ef548bbf10a34db6d98f (diff)
downloadframeworks_av-fee4ce338d78eeb58af1f66831ead53322d3859e.zip
frameworks_av-fee4ce338d78eeb58af1f66831ead53322d3859e.tar.gz
frameworks_av-fee4ce338d78eeb58af1f66831ead53322d3859e.tar.bz2
Merge "Cleanup openRecord error handling" into klp-dev
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 e70d566..a9c9b56 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 b618eff..c46242d 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -4575,7 +4575,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;
}
// client expresses a preference for FAST, but we get the final say
@@ -4638,7 +4638,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);