summaryrefslogtreecommitdiffstats
path: root/media/libmedia/AudioTrack.cpp
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2015-03-20 10:54:51 -0700
committerGlenn Kasten <gkasten@google.com>2015-03-23 08:03:16 -0700
commit138d6f9b0b77d94773a8a29d3c5bdb78f38ee142 (patch)
treee1037f06d855663b9f9521985aea6fcf49171600 /media/libmedia/AudioTrack.cpp
parentb882e936ead71ee407a5d6f1e7194115fc13c410 (diff)
downloadframeworks_av-138d6f9b0b77d94773a8a29d3c5bdb78f38ee142.zip
frameworks_av-138d6f9b0b77d94773a8a29d3c5bdb78f38ee142.tar.gz
frameworks_av-138d6f9b0b77d94773a8a29d3c5bdb78f38ee142.tar.bz2
Update AudioTrack code to match AudioRecord
session ID check buffer error code check Change-Id: I092a61adfd249122f9127dceedf67c0a3bdcfe7b
Diffstat (limited to 'media/libmedia/AudioTrack.cpp')
-rw-r--r--media/libmedia/AudioTrack.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index 8d34587..247c13a 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -1090,6 +1090,7 @@ status_t AudioTrack::createTrack_l()
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;
sp<IAudioTrack> track = audioFlinger->createTrack(streamType,
mSampleRate,
mFormat,
@@ -1102,6 +1103,8 @@ status_t AudioTrack::createTrack_l()
&mSessionId,
mClientUid,
&status);
+ ALOGE_IF(originalSessionId != AUDIO_SESSION_ALLOCATE && mSessionId != originalSessionId,
+ "session ID changed from %d to %d", originalSessionId, mSessionId);
if (status != NO_ERROR) {
ALOGE("AudioFlinger could not create track, status: %d", status);
@@ -1194,9 +1197,13 @@ status_t AudioTrack::createTrack_l()
// address space. AudioFlinger::TrackBase::mBuffer is for the server address space.
void* buffers;
if (mSharedBuffer == 0) {
- buffers = (char*)cblk + sizeof(audio_track_cblk_t);
+ buffers = cblk + 1;
} else {
buffers = mSharedBuffer->pointer();
+ if (buffers == NULL) {
+ ALOGE("Could not get buffer pointer");
+ return NO_INIT;
+ }
}
mAudioTrack->attachAuxEffect(mAuxEffectId);
@@ -1783,7 +1790,7 @@ nsecs_t AudioTrack::processAudioBuffer()
return WAIT_PERIOD_MS * 1000000LL;
}
- size_t releasedFrames = audioBuffer.size / mFrameSize;
+ size_t releasedFrames = writtenSize / mFrameSize;
audioBuffer.frameCount = releasedFrames;
mRemainingFrames -= releasedFrames;
if (misalignment >= releasedFrames) {