Skip to content

Commit 3fe7ee6

Browse files
Eric LaurentAndroid (Google) Code Review
authored andcommitted
Merge "AudioTrack: relax check on minimum buffer size" into ics-mr1
2 parents 90e3bca + 0df6894 commit 3fe7ee6

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

include/media/AudioTrack.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,10 @@ class AudioTrack
130130
* format: Audio format (e.g AUDIO_FORMAT_PCM_16_BIT for signed
131131
* 16 bits per sample).
132132
* channelMask: Channel mask: see audio_channels_t.
133-
* frameCount: Total size of track PCM buffer in frames. This defines the
134-
* latency of the track.
133+
* frameCount: Minimum size of track PCM buffer in frames. This defines the
134+
* latency of the track. The actual size selected by the AudioTrack could be
135+
* larger if the requested size is not compatible with current audio HAL
136+
* latency.
135137
* flags: Reserved for future use.
136138
* cbf: Callback function. If not null, this function is called periodically
137139
* to request new PCM data.

media/libmedia/AudioTrack.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -763,12 +763,9 @@ status_t AudioTrack::createTrack_l(
763763
mNotificationFramesAct = frameCount/2;
764764
}
765765
if (frameCount < minFrameCount) {
766-
if (enforceFrameCount) {
767-
LOGE("Invalid buffer size: minFrameCount %d, frameCount %d", minFrameCount, frameCount);
768-
return BAD_VALUE;
769-
} else {
770-
frameCount = minFrameCount;
771-
}
766+
LOGW_IF(enforceFrameCount, "Minimum buffer size corrected from %d to %d",
767+
frameCount, minFrameCount);
768+
frameCount = minFrameCount;
772769
}
773770
} else {
774771
// Ensure that buffer alignment matches channelcount

0 commit comments

Comments
 (0)