diff options
Diffstat (limited to 'media/libmedia')
-rw-r--r-- | media/libmedia/AudioTrack.cpp | 15 | ||||
-rw-r--r-- | media/libmedia/IAudioTrack.cpp | 2 | ||||
-rw-r--r-- | media/libmedia/ToneGenerator.cpp | 2 | ||||
-rw-r--r-- | media/libmedia/mediaplayer.cpp | 2 |
4 files changed, 10 insertions, 11 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp index e91678a..aead9a1 100644 --- a/media/libmedia/AudioTrack.cpp +++ b/media/libmedia/AudioTrack.cpp @@ -1,4 +1,4 @@ -/* frameworks/base/media/libmedia/AudioTrack.cpp +/* ** ** Copyright 2007, The Android Open Source Project ** @@ -772,7 +772,7 @@ status_t AudioTrack::createTrack_l( } } } else { - // Ensure that buffer alignment matches channelcount + // Ensure that buffer alignment matches channelCount int channelCount = popcount(channelMask); if (((uint32_t)sharedBuffer->pointer() & (channelCount | 1)) != 0) { ALOGE("Invalid buffer alignement: address %p, channelCount %d", sharedBuffer->pointer(), channelCount); @@ -959,7 +959,8 @@ ssize_t AudioTrack::write(const void* buffer, size_t userSize) if (mSharedBuffer != 0) return INVALID_OPERATION; if (ssize_t(userSize) < 0) { - // sanity-check. user is most-likely passing an error code. + // Sanity-check: user is most-likely passing an error code, and it would + // make the return value ambiguous (actualSize vs error). ALOGE("AudioTrack::write(buffer=%p, size=%u (%d)", buffer, userSize, userSize); return BAD_VALUE; @@ -982,8 +983,6 @@ ssize_t AudioTrack::write(const void* buffer, size_t userSize) do { audioBuffer.frameCount = userSize/frameSz; - // Calling obtainBuffer() with a negative wait count causes - // an (almost) infinite wait time. status_t err = obtainBuffer(&audioBuffer, -1); if (err < 0) { // out of buffers, return #bytes written @@ -1073,6 +1072,9 @@ bool AudioTrack::processAudioBuffer(const sp<AudioTrackThread>& thread) frames = mRemainingFrames; } + // See description of waitCount parameter at declaration of obtainBuffer(). + // The logic below prevents us from being stuck below at obtainBuffer() + // not being able to handle timed events (position, markers, loops). int32_t waitCount = -1; if (mUpdatePeriod || (!mMarkerReached && mMarkerPosition) || mLoopCount) { waitCount = 1; @@ -1082,9 +1084,6 @@ bool AudioTrack::processAudioBuffer(const sp<AudioTrackThread>& thread) audioBuffer.frameCount = frames; - // Calling obtainBuffer() with a wait count of 1 - // limits wait time to WAIT_PERIOD_MS. This prevents from being - // stuck here not being able to handle timed events (position, markers, loops). status_t err = obtainBuffer(&audioBuffer, waitCount); if (err < NO_ERROR) { if (err != TIMED_OUT) { diff --git a/media/libmedia/IAudioTrack.cpp b/media/libmedia/IAudioTrack.cpp index 3724642..a7958de 100644 --- a/media/libmedia/IAudioTrack.cpp +++ b/media/libmedia/IAudioTrack.cpp @@ -1,4 +1,4 @@ -/* //device/extlibs/pv/android/IAudioTrack.cpp +/* ** ** Copyright 2007, The Android Open Source Project ** diff --git a/media/libmedia/ToneGenerator.cpp b/media/libmedia/ToneGenerator.cpp index 6cb10aa..54eb98a 100644 --- a/media/libmedia/ToneGenerator.cpp +++ b/media/libmedia/ToneGenerator.cpp @@ -791,7 +791,7 @@ const unsigned char /*tone_type*/ ToneGenerator::sToneMappingTable[NUM_REGIONS-1 // generators, instantiates output audio track. // // Input: -// streamType: Type of stream used for tone playback (enum AudioTrack::stream_type) +// streamType: Type of stream used for tone playback // volume: volume applied to tone (0.0 to 1.0) // // Output: diff --git a/media/libmedia/mediaplayer.cpp b/media/libmedia/mediaplayer.cpp index f1c47dd..250425b 100644 --- a/media/libmedia/mediaplayer.cpp +++ b/media/libmedia/mediaplayer.cpp @@ -1,4 +1,4 @@ -/* mediaplayer.cpp +/* ** ** Copyright 2006, The Android Open Source Project ** |