Merge "Remove dead code in libmedia"
diff --git a/include/media/AudioSystem.h b/include/media/AudioSystem.h
index 66f4b84..61d62b0 100644
--- a/include/media/AudioSystem.h
+++ b/include/media/AudioSystem.h
@@ -126,6 +126,7 @@
// necessary to check returned status before using the returned values.
static status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, audio_stream_type_t stream = AUDIO_STREAM_DEFAULT);
+ // return the number of input frames lost by HAL implementation, or 0 if the handle is invalid
static unsigned int getInputFramesLost(audio_io_handle_t ioHandle);
static int newAudioSessionId();
diff --git a/include/media/IAudioFlinger.h b/include/media/IAudioFlinger.h
index 5d95b3b..bdd0142 100644
--- a/include/media/IAudioFlinger.h
+++ b/include/media/IAudioFlinger.h
@@ -48,7 +48,7 @@
enum {
TRACK_DEFAULT = 0, // client requests a default AudioTrack
TRACK_TIMED = 1, // client requests a TimedAudioTrack
- TRACK_FAST = 2, // client requests a fast AudioTrack
+ TRACK_FAST = 2, // client requests a fast AudioTrack or AudioRecord
};
typedef uint32_t track_flags_t;
@@ -77,6 +77,7 @@
audio_channel_mask_t channelMask,
int frameCount,
track_flags_t flags,
+ pid_t tid, // -1 means unused, otherwise must be valid non-0
int *sessionId,
status_t *status) = 0;
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp
index f8813c9..d3c0b2b 100644
--- a/media/libmedia/AudioRecord.cpp
+++ b/media/libmedia/AudioRecord.cpp
@@ -432,10 +432,8 @@
unsigned int AudioRecord::getInputFramesLost() const
{
- if (mActive)
- return AudioSystem::getInputFramesLost(mInput);
- else
- return 0;
+ // no need to check mActive, because if inactive this will return 0, which is what we want
+ return AudioSystem::getInputFramesLost(mInput);
}
// -------------------------------------------------------------------------
@@ -454,11 +452,15 @@
return NO_INIT;
}
+ pid_t tid = -1;
+ // FIXME see similar logic at AudioTrack
+
sp<IAudioRecord> record = audioFlinger->openRecord(getpid(), input,
sampleRate, format,
channelMask,
frameCount,
IAudioFlinger::TRACK_DEFAULT,
+ tid,
&mSessionId,
&status);
diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp
index 27f6b45..f5d6fd6 100644
--- a/media/libmedia/IAudioFlinger.cpp
+++ b/media/libmedia/IAudioFlinger.cpp
@@ -138,6 +138,7 @@
uint32_t channelMask,
int frameCount,
track_flags_t flags,
+ pid_t tid,
int *sessionId,
status_t *status)
{
@@ -151,6 +152,7 @@
data.writeInt32(channelMask);
data.writeInt32(frameCount);
data.writeInt32(flags);
+ data.writeInt32((int32_t) tid);
int lSessionId = 0;
if (sessionId != NULL) {
lSessionId = *sessionId;
@@ -726,10 +728,11 @@
audio_channel_mask_t channelMask = data.readInt32();
size_t bufferCount = data.readInt32();
track_flags_t flags = (track_flags_t) data.readInt32();
+ pid_t tid = (pid_t) data.readInt32();
int sessionId = data.readInt32();
status_t status;
sp<IAudioRecord> record = openRecord(pid, input,
- sampleRate, format, channelMask, bufferCount, flags, &sessionId, &status);
+ sampleRate, format, channelMask, bufferCount, flags, tid, &sessionId, &status);
reply->writeInt32(sessionId);
reply->writeInt32(status);
reply->writeStrongBinder(record->asBinder());
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 765127a..fc4969e 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -978,10 +978,6 @@
unsigned int AudioFlinger::getInputFramesLost(audio_io_handle_t ioHandle) const
{
- if (ioHandle == 0) {
- return 0;
- }
-
Mutex::Autolock _l(mLock);
RecordThread *recordThread = checkRecordThread_l(ioHandle);
@@ -5797,6 +5793,7 @@
audio_channel_mask_t channelMask,
int frameCount,
IAudioFlinger::track_flags_t flags,
+ pid_t tid,
int *sessionId,
status_t *status)
{
@@ -5835,13 +5832,8 @@
}
}
// create new record track. The record track uses one track in mHardwareMixerThread by convention.
- recordTrack = thread->createRecordTrack_l(client,
- sampleRate,
- format,
- channelMask,
- frameCount,
- lSessionId,
- &lStatus);
+ recordTrack = thread->createRecordTrack_l(client, sampleRate, format, channelMask,
+ frameCount, lSessionId, flags, tid, &lStatus);
}
if (lStatus != NO_ERROR) {
// remove local strong reference to Client before deleting the RecordTrack so that the Client
@@ -6152,6 +6144,8 @@
audio_channel_mask_t channelMask,
int frameCount,
int sessionId,
+ IAudioFlinger::track_flags_t flags,
+ pid_t tid,
status_t *status)
{
sp<RecordTrack> track;
@@ -6163,6 +6157,8 @@
goto Exit;
}
+ // FIXME use flags and tid similar to createTrack_l()
+
{ // scope for mLock
Mutex::Autolock _l(mLock);
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index f9e53e2..648a8d2 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -108,6 +108,7 @@
audio_channel_mask_t channelMask,
int frameCount,
IAudioFlinger::track_flags_t flags,
+ pid_t tid,
int *sessionId,
status_t *status);
@@ -1407,6 +1408,8 @@
audio_channel_mask_t channelMask,
int frameCount,
int sessionId,
+ IAudioFlinger::track_flags_t flags,
+ pid_t tid,
status_t *status);
status_t start(RecordTrack* recordTrack,