From 0c04699de90c89a00eb39256b60f59723f323d05 Mon Sep 17 00:00:00 2001 From: Leena Winterrowd Date: Fri, 11 Dec 2015 17:06:13 -0800 Subject: AudioTrack: Set DIRECT track flag for direct pcm output While direct output should ideally be abstracted from the AudioTrack, the use of an offload path can leave data stuck in the shared buffer (especially if the clip is short such that the buffer is never entirely filled). To ensure that all data is played out on track stop(), AudioTrack must be aware of the direct output or offload session. Set the DIRECT track flag for track offload use cases to avoid losing data in the shared buffer. CRs-Fixed: 944878 Change-Id: I13f840b5d67be56e03ec65d3bc7d44f1090b48c5 --- media/libmedia/AudioTrack.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'media/libmedia') diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp index ff57b44..d7256f8 100644 --- a/media/libmedia/AudioTrack.cpp +++ b/media/libmedia/AudioTrack.cpp @@ -1297,7 +1297,7 @@ status_t AudioTrack::createTrack_l() trackFlags |= IAudioFlinger::TRACK_OFFLOAD; } - if (mFlags & AUDIO_OUTPUT_FLAG_DIRECT) { + if ((mFlags & AUDIO_OUTPUT_FLAG_DIRECT) || mTrackOffloaded) { trackFlags |= IAudioFlinger::TRACK_DIRECT; } -- cgit v1.1