Merge "AudioTrack: relax check on minimum buffer size" into ics-mr1

This commit is contained in:
Eric Laurent
2012-03-16 14:58:07 -07:00
committed by Android (Google) Code Review
2 changed files with 7 additions and 8 deletions

View File

@@ -130,8 +130,10 @@ public:
* format: Audio format (e.g AUDIO_FORMAT_PCM_16_BIT for signed
* 16 bits per sample).
* channelMask: Channel mask: see audio_channels_t.
* frameCount: Total size of track PCM buffer in frames. This defines the
* latency of the track.
* frameCount: Minimum size of track PCM buffer in frames. This defines the
* latency of the track. The actual size selected by the AudioTrack could be
* larger if the requested size is not compatible with current audio HAL
* latency.
* flags: Reserved for future use.
* cbf: Callback function. If not null, this function is called periodically
* to request new PCM data.

View File

@@ -763,12 +763,9 @@ status_t AudioTrack::createTrack_l(
mNotificationFramesAct = frameCount/2;
}
if (frameCount < minFrameCount) {
if (enforceFrameCount) {
LOGE("Invalid buffer size: minFrameCount %d, frameCount %d", minFrameCount, frameCount);
return BAD_VALUE;
} else {
frameCount = minFrameCount;
}
LOGW_IF(enforceFrameCount, "Minimum buffer size corrected from %d to %d",
frameCount, minFrameCount);
frameCount = minFrameCount;
}
} else {
// Ensure that buffer alignment matches channelcount