summaryrefslogtreecommitdiffstats
path: root/media/libmedia/IAudioFlinger.cpp
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2010-01-19 17:37:09 -0800
committerEric Laurent <elaurent@google.com>2010-01-26 18:40:39 -0800
commit0986e7907ffc8387b04fb201e285784bcd11b9b7 (patch)
tree96733235d1e92e0f329ded11b9b55c0d67a4ca83 /media/libmedia/IAudioFlinger.cpp
parent7d3a558b9ebf2256517ec99cd09c066cc7dbc92c (diff)
downloadframeworks_base-0986e7907ffc8387b04fb201e285784bcd11b9b7.zip
frameworks_base-0986e7907ffc8387b04fb201e285784bcd11b9b7.tar.gz
frameworks_base-0986e7907ffc8387b04fb201e285784bcd11b9b7.tar.bz2
Fix issue 2285561: New AudioFlinger and audio driver API needed for A/V sync
Added getRenderPosition() API to IAudioFlinger to retreive number of audio frames written by AudioFlinger to audio HAL and by DSP to DAC. Added getRenderPosition() API to AudioHardwareInterface to retreive number of audio frames written by DSP to DAC. Exposed AudioTrack::getPosition() to AudioSink() to make it available to media player. Removed excessive log in AudioHardwareGeneric.
Diffstat (limited to 'media/libmedia/IAudioFlinger.cpp')
-rw-r--r--media/libmedia/IAudioFlinger.cpp36
1 files changed, 35 insertions, 1 deletions
diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp
index fc42979..ca3a2a6 100644
--- a/media/libmedia/IAudioFlinger.cpp
+++ b/media/libmedia/IAudioFlinger.cpp
@@ -60,7 +60,8 @@ enum {
OPEN_INPUT,
CLOSE_INPUT,
SET_STREAM_OUTPUT,
- SET_VOICE_VOLUME
+ SET_VOICE_VOLUME,
+ GET_RENDER_POSITION
};
class BpAudioFlinger : public BpInterface<IAudioFlinger>
@@ -466,6 +467,26 @@ public:
remote()->transact(SET_VOICE_VOLUME, data, &reply);
return reply.readInt32();
}
+
+ virtual status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, int output)
+ {
+ Parcel data, reply;
+ data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
+ data.writeInt32(output);
+ remote()->transact(GET_RENDER_POSITION, data, &reply);
+ status_t status = reply.readInt32();
+ if (status == NO_ERROR) {
+ uint32_t tmp = reply.readInt32();
+ if (halFrames) {
+ *halFrames = tmp;
+ }
+ tmp = reply.readInt32();
+ if (dspFrames) {
+ *dspFrames = tmp;
+ }
+ }
+ return status;
+ }
};
IMPLEMENT_META_INTERFACE(AudioFlinger, "android.media.IAudioFlinger");
@@ -718,6 +739,19 @@ status_t BnAudioFlinger::onTransact(
reply->writeInt32( setVoiceVolume(volume) );
return NO_ERROR;
} break;
+ case GET_RENDER_POSITION: {
+ CHECK_INTERFACE(IAudioFlinger, data, reply);
+ int output = data.readInt32();
+ uint32_t halFrames;
+ uint32_t dspFrames;
+ status_t status = getRenderPosition(&halFrames, &dspFrames, output);
+ reply->writeInt32(status);
+ if (status == NO_ERROR) {
+ reply->writeInt32(halFrames);
+ reply->writeInt32(dspFrames);
+ }
+ return NO_ERROR;
+ }
default:
return BBinder::onTransact(code, data, reply, flags);
}