summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2014-07-03 12:23:29 -0700
committerGlenn Kasten <gkasten@google.com>2014-07-03 16:28:41 -0700
commit7df8c0b799d8f52d6386e03313286dbd7d5cdc7c (patch)
treee87404b99042b2c21ffcc0c34ac397ae14b4c2d4
parent7c6f87856c0880ee39c2107a0fc3c9b41f8c195c (diff)
downloadframeworks_av-7df8c0b799d8f52d6386e03313286dbd7d5cdc7c.zip
frameworks_av-7df8c0b799d8f52d6386e03313286dbd7d5cdc7c.tar.gz
frameworks_av-7df8c0b799d8f52d6386e03313286dbd7d5cdc7c.tar.bz2
IAudioFlinger::openRecord now suggests notificationFrames
Change-Id: I08885cc381d03c522a23289e74f0e1ed46563863
-rw-r--r--include/media/IAudioFlinger.h1
-rw-r--r--media/libmedia/AudioRecord.cpp5
-rw-r--r--media/libmedia/IAudioFlinger.cpp8
-rw-r--r--services/audioflinger/AudioFlinger.cpp3
-rw-r--r--services/audioflinger/AudioFlinger.h1
-rwxr-xr-xservices/audioflinger/Threads.cpp2
-rw-r--r--services/audioflinger/Threads.h1
7 files changed, 20 insertions, 1 deletions
diff --git a/include/media/IAudioFlinger.h b/include/media/IAudioFlinger.h
index fc8be20..2c960be 100644
--- a/include/media/IAudioFlinger.h
+++ b/include/media/IAudioFlinger.h
@@ -89,6 +89,7 @@ public:
track_flags_t *flags,
pid_t tid, // -1 means unused, otherwise must be valid non-0
int *sessionId,
+ size_t *notificationFrames,
sp<IMemory>& cblk,
sp<IMemory>& buffers, // return value 0 means it follows cblk
status_t *status) = 0;
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp
index f865d38..3ee5809 100644
--- a/media/libmedia/AudioRecord.cpp
+++ b/media/libmedia/AudioRecord.cpp
@@ -495,6 +495,10 @@ status_t AudioRecord::openRecord_l(size_t epoch)
size_t temp = frameCount; // temp may be replaced by a revised value of frameCount,
// but we will still need the original value also
int originalSessionId = mSessionId;
+
+ // The notification frame count is the period between callbacks, as suggested by the server.
+ size_t notificationFrames;
+
sp<IMemory> iMem; // for cblk
sp<IMemory> bufferMem;
sp<IAudioRecord> record = audioFlinger->openRecord(input,
@@ -504,6 +508,7 @@ status_t AudioRecord::openRecord_l(size_t epoch)
&trackFlags,
tid,
&mSessionId,
+ &notificationFrames,
iMem,
bufferMem,
&status);
diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp
index 687fa76..5cf42f7 100644
--- a/media/libmedia/IAudioFlinger.cpp
+++ b/media/libmedia/IAudioFlinger.cpp
@@ -175,6 +175,7 @@ public:
track_flags_t *flags,
pid_t tid,
int *sessionId,
+ size_t *notificationFrames,
sp<IMemory>& cblk,
sp<IMemory>& buffers,
status_t *status)
@@ -214,6 +215,10 @@ public:
if (sessionId != NULL) {
*sessionId = lSessionId;
}
+ size_t lNotificationFrames = (size_t) reply.readInt64();
+ if (notificationFrames != NULL) {
+ *notificationFrames = lNotificationFrames;
+ }
lStatus = reply.readInt32();
record = interface_cast<IAudioRecord>(reply.readStrongBinder());
cblk = interface_cast<IMemory>(reply.readStrongBinder());
@@ -959,16 +964,19 @@ status_t BnAudioFlinger::onTransact(
track_flags_t flags = (track_flags_t) data.readInt32();
pid_t tid = (pid_t) data.readInt32();
int sessionId = data.readInt32();
+ size_t notificationFrames = 0;
sp<IMemory> cblk;
sp<IMemory> buffers;
status_t status;
sp<IAudioRecord> record = openRecord(input,
sampleRate, format, channelMask, &frameCount, &flags, tid, &sessionId,
+ &notificationFrames,
cblk, buffers, &status);
LOG_ALWAYS_FATAL_IF((record != 0) != (status == NO_ERROR));
reply->writeInt64(frameCount);
reply->writeInt32(flags);
reply->writeInt32(sessionId);
+ reply->writeInt64(notificationFrames);
reply->writeInt32(status);
reply->writeStrongBinder(record->asBinder());
reply->writeStrongBinder(cblk->asBinder());
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 11a01cc..bb17221 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -1344,6 +1344,7 @@ sp<IAudioRecord> AudioFlinger::openRecord(
IAudioFlinger::track_flags_t *flags,
pid_t tid,
int *sessionId,
+ size_t *notificationFrames,
sp<IMemory>& cblk,
sp<IMemory>& buffers,
status_t *status)
@@ -1418,7 +1419,7 @@ sp<IAudioRecord> AudioFlinger::openRecord(
// TODO: the uid should be passed in as a parameter to openRecord
recordTrack = thread->createRecordTrack_l(client, sampleRate, format, channelMask,
- frameCount, lSessionId,
+ frameCount, lSessionId, notificationFrames,
IPCThreadState::self()->getCallingUid(),
flags, tid, &lStatus);
LOG_ALWAYS_FATAL_IF((lStatus == NO_ERROR) && (recordTrack == 0));
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index ddc6afb..f6a0182 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -120,6 +120,7 @@ public:
IAudioFlinger::track_flags_t *flags,
pid_t tid,
int *sessionId,
+ size_t *notificationFrames,
sp<IMemory>& cblk,
sp<IMemory>& buffers,
status_t *status /*non-NULL*/);
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 67a0119..1dcaff8 100755
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -5443,6 +5443,7 @@ sp<AudioFlinger::RecordThread::RecordTrack> AudioFlinger::RecordThread::createRe
audio_channel_mask_t channelMask,
size_t *pFrameCount,
int sessionId,
+ size_t *notificationFrames,
int uid,
IAudioFlinger::track_flags_t *flags,
pid_t tid,
@@ -5512,6 +5513,7 @@ sp<AudioFlinger::RecordThread::RecordTrack> AudioFlinger::RecordThread::createRe
}
}
*pFrameCount = frameCount;
+ *notificationFrames = 0; // FIXME implement
lStatus = initCheck();
if (lStatus != NO_ERROR) {
diff --git a/services/audioflinger/Threads.h b/services/audioflinger/Threads.h
index 93d2635..1493c60 100644
--- a/services/audioflinger/Threads.h
+++ b/services/audioflinger/Threads.h
@@ -1073,6 +1073,7 @@ public:
audio_channel_mask_t channelMask,
size_t *pFrameCount,
int sessionId,
+ size_t *notificationFrames,
int uid,
IAudioFlinger::track_flags_t *flags,
pid_t tid,