History log of /frameworks/av/media/libmedia/AudioTrackShared.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
ea2b9c07b34079f0dbd8610a511e006e69a15adc 13-Feb-2016 Andy Hung <hunga@google.com> Implement client playback timestamps with 64 bit accuracy

Provide server timestamps if the HAL doesn't provide it.
Provide monotonic - boottime translation.

Bug: 17472992
Bug: 26682703
Bug: 27749434
Change-Id: I6c9b213d9f9284092e34d57f52870e02c72df62a
/frameworks/av/media/libmedia/AudioTrackShared.cpp
9887c3e252ec0571ee8637310ea9ec2eec118044 30-Mar-2016 Ian Ni-Lewis <ilewis@google.com> Merge "Remove integer sanitization from ringbuffer pointer arithmetic" into nyc-dev
926b82fa9e22739686602f7ae8cf24105f14d82e 29-Mar-2016 ilewis <inl@google.com> Remove integer sanitization from ringbuffer pointer arithmetic

The AudioTrackShared ringbuffer uses int32 positions and allows overflow.
This confuses the integer sanitization code and makes it panic.
The simplest solution for now seems to be to remove sanitization
from the methods that touch the ringbuffer pointers.

Bug 27680456

Change-Id: Ie4d7daf0fb1e4e223ee97c412af7b1bd9c6916eb
/frameworks/av/media/libmedia/AudioTrackShared.cpp
26760d1a1105b6b318c837a491cdb96f6901804e 21-Mar-2016 Phil Burk <philburk@google.com> AudioTrackShared: fix min buffer size

Fast Tracks can have very low buffer sizes.

Bug: 27765661
Bug: 27765632
Change-Id: I70262b2a0136aea3c0936aec85f15b0fc78d168f
Signed-off-by: Phil Burk <philburk@google.com>
/frameworks/av/media/libmedia/AudioTrackShared.cpp
fc1337d079ba7e6ffd7ce07706cfeeeb355c0200 18-Mar-2016 Phil Burk <philburk@google.com> Merge "AudioTrack: fix stall if setBufferSizeInFrames() called before play()" into nyc-dev
e8972b0a27fac327c997fceb20d9abae1dc1d899 04-Mar-2016 Phil Burk <philburk@google.com> AudioTrack: fix stall if setBufferSizeInFrames() called before play()

The server was waiting for a full buffer.
But the buffer was only getting partly filled.
So the stream was not starting.

The fix involves having the server look at the adjustable threshold.

Bug: 27505889
Change-Id: I5dbf686413e670dacbbecc9e0f838744e465f44f
Signed-off-by: Phil Burk <philburk@google.com>
/frameworks/av/media/libmedia/AudioTrackShared.cpp
4d231dc0ee34380956c71cbe18a750e487a69601 12-Mar-2016 Eric Laurent <elaurent@google.com> audio: Fix race condition in AudioTrack underrun.

When audio flinger mixer removes an AudioTrack from the
active list in case of underrun, it is possible that the
client has written a full buffer just after the underrun detection and
is blocked waiting for more space to write. In this case, the client
will never detect the DISABLED flag and the track never be restarted.

Also implement missing DISABLE flag detection in server side audio tracks
(OutputTrack and PatchTrack).

bug: 27567768
Change-Id: I8d0753429d4113498258b1f61bd8ac5939a612f0
/frameworks/av/media/libmedia/AudioTrackShared.cpp
6ae5843c281301a9ffd1059d185620a9337e15a2 17-Feb-2016 Andy Hung <hunga@google.com> Enable FastTrack timestamps

Bug: 26413951
Change-Id: Id54c32cb0f0be83d443f6cf1007181ebc461c586
/frameworks/av/media/libmedia/AudioTrackShared.cpp
3f0c902beb53a245c9db35e871607dba05b8d391 16-Jan-2016 Andy Hung <hunga@google.com> Add AudioRecord timestamps

Bug: 13569372
Bug: 22886739
Change-Id: Ibc81afefb733d23676a632a0f2da31163fdbe05f
/frameworks/av/media/libmedia/AudioTrackShared.cpp
bdd8101cd487cdfe36726aa0d78c24008c35d605 30-Jan-2016 Eric Laurent <elaurent@google.com> AudioTrack: fix ClientProxy::obtainBuffer() size clamping

Fix data cast in comparison that can cause large unsigned values to
be considered small negative values, causing a wrong buffer size
calculation.

Change-Id: I3b7d4326659c38e744338b5d1ae456c859c89abf
/frameworks/av/media/libmedia/AudioTrackShared.cpp
bbe98f009fc2c3181a8d4ab71b3e145f76c01755 17-Jan-2016 Phil Burk <philburk@google.com> Merge "AudioTrack: Add getUnderrunCount()"
c0adecb800b197cb8c028513130ebabf2d0f37ba 08-Jan-2016 Phil Burk <philburk@google.com> AudioTrack: add setBufferSizeInFrames()

Also add getBufferCapacityInFrames().
These can be used to dynamically raise or lower latency.

Bug: 21019153
Signed-off-by: Phil Burk <philburk@google.com>
Change-Id: I02ca7f6f5cc4e089fcd81cc8a2b6ff234e0381a8
/frameworks/av/media/libmedia/AudioTrackShared.cpp
2812d9ea3a3a33142dd8e23c9d949c498d6f7a12 04-Jan-2016 Phil Burk <philburk@google.com> AudioTrack: Add getUnderrunCount()

This allows an app to detect application-level output glitches.
Underrun counts survive track recreation.

Change-Id: I8eb14e92f6fc1007718a29b0666ab51ace30cdb8
Bug: 25641253
Signed-off-by: Phil Burk <philburk@google.com>
/frameworks/av/media/libmedia/AudioTrackShared.cpp
59950b403076a94828668902d30215ac5a733902 20-Aug-2014 Glenn Kasten <gkasten@google.com> Remove unused ClientProxy::getFramesFilled()

Change-Id: Ib3cf5a6b61572a1bff89bdd62262fdcf9f09aedc
/frameworks/av/media/libmedia/AudioTrackShared.cpp
b463da8e499149c7230b8dbd839bb7bc8ece602f 15-Dec-2015 Leena Winterrowd <lenhardw@codeaurora.org> libmedia: Preserve futex return status in client obtainBuffer

clock_gettime() can change errno if something goes wrong (most
commonly setting EBADF). This failure should not cause a failure
in ClientProxy::obtainBuffer() if the futex returned successfully
or with a known status. Preserve errno before calling clock_gettime
to prevent propagation of an invalid, unexpected error.

authored-by: Leena Winterrowd <lenhardw@codeaurora.org>

Change-Id: Ib69201031a81395ece47dd8ad7c4dcddd2b00153
/frameworks/av/media/libmedia/AudioTrackShared.cpp
77cce44fd360e4bd47ad3427ea14beb15b515d24 14-Oct-2015 Glenn Kasten <gkasten@google.com> am 0aa9146d: am 8fa0848c: Merge "For static obtainBuffer(), do not set mUnreleased if acknowledging flush." into mnc-dr-dev

* commit '0aa9146d7cf84e00958f8758564b161395d44bfe':
For static obtainBuffer(), do not set mUnreleased if acknowledging flush.
954ca45ac30539a49f179580b667b0ab1056d113 09-Sep-2015 Andy Hung <hunga@google.com> For static obtainBuffer(), do not set mUnreleased if acknowledging flush.

static audio tracks use obtainBuffer() to update position in start().

Bug: 22938515
Change-Id: I8ae32f6cce4d122386d2cf8982e158049b04ba9a
/frameworks/av/media/libmedia/AudioTrackShared.cpp
cb50c54b31a83ac598530780fa8c145a3cb4a2de 07-Oct-2015 Chad Brubaker <cbrubaker@google.com> Fix benign unsigned overflow in AuidoTrackShared

fsanitize=integer adds unsigned checks to int32_t - uint32_t, force both
operands to int32_t to avoid such checks being added.

Change-Id: I76fce38f9636f5322ad95fdb81abb690503f4d08
/frameworks/av/media/libmedia/AudioTrackShared.cpp
d9459157206859d44d68ce908bff359b0d01f51f 24-Sep-2015 Chad Brubaker <cbrubaker@google.com> Fix benign overflow in AudioTrackShared

Bug: 24340611
Change-Id: Idc1e6ae09839475379bf0ab27943ae2de6f80bfa
(cherry picked from commit 0c27d279a1a99d175b84cc530ce2bfb0665b308b)
/frameworks/av/media/libmedia/AudioTrackShared.cpp
e9fa23fe940c287bf2f6e8b28f4cf9161818cb80 23-Sep-2015 Chad Brubaker <cbrubaker@google.com> resolved conflicts for 1f8749f2 to stage-aosp-master

Change-Id: Idda60a9d39f9be81e0c314f06fc080ad7fa35c7b
65dda4f09425ad027e27a51a3108472448d3ab8b 23-Sep-2015 Chad Brubaker <cbrubaker@google.com> Fix benign overflow in ClientProxy::getMisalignment

Change-Id: Ia4537f5b7a8c21178368fa2303602399a3f8fc36
/frameworks/av/media/libmedia/AudioTrackShared.cpp
dbd0f3c5e15e56c2d91ae1405fecf2279785ef00 17-Jul-2015 Glenn Kasten <gkasten@google.com> Fix build

Change-Id: I18b63d68d452c4ee7544ff1614f4e3f57f5a9e73
/frameworks/av/media/libmedia/AudioTrackShared.cpp
a2d75cdb1e389f2b4ce5992fb6652399b4d30966 16-Jul-2015 Andy Hung <hunga@google.com> Fix AudioTrack flush pointer wrap

Occurs when read offset / write offset span the power of 2
mask boundary.

Bug: 22513776
Change-Id: If863577dac6666e8b2083d78f78fe9b9490fcf76
/frameworks/av/media/libmedia/AudioTrackShared.cpp
5a8a95de6dad1a3bcf3da5a37b35766e89086e13 18-Apr-2015 Ricardo Garcia <rago@google.com> Use AudioPlaybackRate to hold TimestretchBufferProvider parameters

Use this struct to handle the parameters for TimestretchBufferProvider all
across the system.
Add stretch mode and fallback mode to TimestretchBuffer Provider.

Change-Id: I19099924a7003c62e48bb6ead56c785cb129fba2
/frameworks/av/media/libmedia/AudioTrackShared.cpp
f1063e2659cad01ec334a265c31734c63c319cc4 18-Apr-2015 Lajos Molnar <lajos@google.com> libmedia: fix all warning, make warnings errors, use clang

Change-Id: Ic00d2c5d0bbb1605e96666e25c9ccc22bea6d3ff
/frameworks/av/media/libmedia/AudioTrackShared.cpp
8edb8dc44b8a2f81bdb5db645b6b708548771a31 27-Mar-2015 Andy Hung <hunga@google.com> Add playback rate to AudioTrack

Bug: 19196501
Change-Id: I6411e1d3ce652b711a71a6d9df020cb5f60d4714
/frameworks/av/media/libmedia/AudioTrackShared.cpp
f59497bd3c190e087202043de5450ef06e92b27d 27-Jan-2015 Glenn Kasten <gkasten@google.com> Update comments

Change-Id: I37d3c4ce22b74fe8581a886fe5a7f9fef8266dad
/frameworks/av/media/libmedia/AudioTrackShared.cpp
4ede21d9c1f957baf5e561849ff9bbe4bcbefc20 13-Dec-2014 Andy Hung <hunga@google.com> Fix loop and position restoration in static AudioTracks

Allow restoration of loop and position.
Make position and loop synchronously readable.

Bug: 17964637
Change-Id: I8cfb5036e665f55fdff5c67d27e1363ce9a8665d
/frameworks/av/media/libmedia/AudioTrackShared.cpp
9b4615887c23548438fd0d8e3d8f04ac21912850 02-Dec-2014 Andy Hung <hunga@google.com> Fix loop and position setting in static AudioTracks

Allow independent setting of position and loop.

Bug: 17964637
Change-Id: I8b3bd97a244b932728b68da7684044f2636984a5
/frameworks/av/media/libmedia/AudioTrackShared.cpp
b187de1ada34a9023c05d020a4592686ba761278 30-Dec-2014 Glenn Kasten <gkasten@google.com> Line length 100

Change-Id: I6c8fe626a3825fa9e139319656d682a57b887c97
/frameworks/av/media/libmedia/AudioTrackShared.cpp
486a7135593b4b40c067e9b06f393577abfef482 23-Dec-2014 Andy Hung <hunga@google.com> Fix 64 bit compiler warnings in AudioTrackShared

Comparisons between size_t and int64_t variables show
warnings for 64 bit compilation, fix with casting.

Change-Id: I3c1b12ea6eca01e49696c724a1cf1cc6b88df7aa
/frameworks/av/media/libmedia/AudioTrackShared.cpp
82a69ea8b090d57bff5e02774688b546a711bbb8 07-Nov-2014 zunkyu.lee <zunkyu.lee@lge.com> Prevent ANR when AudioTrack is paused or re-routed

If ClientProxy was interrupted by AudioTrack::pause() just before futex syscall() in obtainBuffer() was called,
It will not call releaseBuffer to wake up AudioTrackThread.
It puts the AudioTrackThread to sleep and then a deadlock occurs.

In this case, CBLK_INTERRUPT flags can't prevent a deadlock,
so this patch set mFutex to FUTEX_WAKE during interrupt() to avoid deadlock.

A similar problem could occur due to re-route or recovery after mediaserver death.

Bug: 18641665
Change-Id: I66fcae43af9a91eb55f6cdb52c644ee6c0999772
/frameworks/av/media/libmedia/AudioTrackShared.cpp
680b795435a5a501a56610258dce5eda40a1725d 12-Nov-2014 Andy Hung <hunga@google.com> Fix AudioTrack loop mode to play audio from buffer start

Bug: 18217633
Change-Id: Ica77acf0a32832d9b04eb657ef2f4f5329f8fbda
/frameworks/av/media/libmedia/AudioTrackShared.cpp
cb2129b3b568a4e31bcbda3545a468024bc972fe 11-Nov-2014 Andy Hung <hunga@google.com> Fix missing loop count for static tracks.

StaticAudioTrackServerProxy::framesReady() previously returned
only the contiguous frames, update to return the total
available frames. This resolves short-count looping in
SoundPool for FastTracks.

Also (1) Removes the racy condition of reading two variables
and (2) Fixes buffer->mNonContig to return the correct value
and (3) Restores behavior that loop count of 1 goes back to
loopStart once during playback.

Bug: 11830751
Bug: 12070295
Bug: 17456842
Change-Id: I64906e6036bb00a1d7375b03efe6deb69d6478ca
/frameworks/av/media/libmedia/AudioTrackShared.cpp
20f51b1ea04c410a25f214e37bcdb586e2a028cc 30-Oct-2014 Glenn Kasten <gkasten@google.com> AudioTrack::flush() will no longer flush later data

Bug: 17832076
Change-Id: I4915d782acb8077923e419406b0dcea5b6aab961
/frameworks/av/media/libmedia/AudioTrackShared.cpp
34fb29696b0f3abf61b10f8d053b1f33d501de0a 19-Jun-2014 Mark Salyzyn <salyzyn@google.com> libmedia: 64-bit compile warnings

Change-Id: I600f062fa7148c01851023c1240c39939e648002
/frameworks/av/media/libmedia/AudioTrackShared.cpp
6dbb5e3336cfff1ad51d429fcb847307c06efd61 13-May-2014 Glenn Kasten <gkasten@google.com> Use of fast capture by normal capture

Will only configure fast capture path if the input buffer size is less than
10 ms and the input sample rate is same as the primary output sample rate.

Change-Id: I4a7cdc6069d750845412c626d27e83f72a1ab397
/frameworks/av/media/libmedia/AudioTrackShared.cpp
e348c5b72ad889389c7c1c900c121f0fbee221b5 22-May-2014 Elliott Hughes <enh@google.com> resolved conflicts for merge of c0bf836f to master

Change-Id: I5cf238fa56d6fff443b212870cf9dd7f1110e7da
ee499291404a192b059f2e04c5afc65aa6cdd74c 22-May-2014 Elliott Hughes <enh@google.com> Move frameworks/av off private API.

Bug: 11156955
Change-Id: Ib3bb9d66a2bf92977c2445b62aa074a2d7a45aea
/frameworks/av/media/libmedia/AudioTrackShared.cpp
9382378b6b271949bdce527ea3da748c13c4c692 22-May-2014 Elliott Hughes <enh@google.com> resolved conflicts for merge of b1080917 to master

Change-Id: Iabbe3e95e29f28461ff722b550e8a9f35bd2528f
77e1512aee8092069514973379a59a318e721be3 22-May-2014 Elliott Hughes <enh@google.com> Move frameworks/av off __futex_syscall3.

Bug: 11156955
Change-Id: I943080bc51b6efa781059b48b5b5ecc4fa287512
/frameworks/av/media/libmedia/AudioTrackShared.cpp
c56f3426099a3cf2d07ccff8886050c7fbce140f 22-Mar-2014 Glenn Kasten <gkasten@google.com> Pass stereo gains as packed minifloat

This will allow (eventually) a greater dynamic range for gains.
However there are still a few remaining places in effects and mixer
that will also need to be changed in order to get the full benefit.

Also fixes a minor bug: was not checking for NaN in AudioTrack C++.

Change-Id: I63bce9e82e0a61546d8ff475fb94bcb700d99c96
/frameworks/av/media/libmedia/AudioTrackShared.cpp
844f88ccfcca95687e774bccb5e9065da61d33f8 09-May-2014 Glenn Kasten <gkasten@google.com> Cache mCblk in local variable cblk

This is the style used throughout the rest of AudioTrackShared.

Change-Id: I959a6be3064e087bb19eba41173fd130dfcb4a9a
/frameworks/av/media/libmedia/AudioTrackShared.cpp
adad3d7d935da176ff24941b4ae9edf7340e9b96 21-Feb-2014 Glenn Kasten <gkasten@google.com> Use LOG_ALWAYS_FATAL instead of LOG_FATAL

LOG_FATAL is compiled out in most builds, so the
assertion checks were not being performed.

Change-Id: I774f0985ab9c5ccecd8989a0f1c940386b73fc35
/frameworks/av/media/libmedia/AudioTrackShared.cpp
751a9c8cbc391a91604dd1052fb95d3e4d278c2f 28-Jan-2014 Glenn Kasten <gkasten@google.com> Replace size_t in shared memory by uint32_t

Eventually we may want to use uint64_t, but will need to confirm atomicity.

Bug: 12381724
Change-Id: Ia2c591d262d22b47b6f7dab4b9d9faa14b86d865
/frameworks/av/media/libmedia/AudioTrackShared.cpp
fdac7c00f9201bb3a9862069145f01d37e39755b 28-Jan-2014 Glenn Kasten <gkasten@google.com> Replace size_t in shared memory by uint32_t

Eventually we may want to use uint64_t, but will need to confirm atomicity.

Bug: 12381724
Change-Id: Ia2c591d262d22b47b6f7dab4b9d9faa14b86d865
/frameworks/av/media/libmedia/AudioTrackShared.cpp
f0002d142e6d24c5438600b2c259679de710f8ac 24-Jan-2014 Glenn Kasten <gkasten@google.com> Merge "Replace control block frameCount_ by explicit in/out parameter"
74935e44734c1ec235c2b6677db3e0dbefa5ddb8 19-Dec-2013 Glenn Kasten <gkasten@google.com> Replace control block frameCount_ by explicit in/out parameter

in IAudioFlinger::createTrack and IAudioFlinger::openRecord

Change-Id: I09c644c80e92c8e744b1b99055988a2588b2a83d
/frameworks/av/media/libmedia/AudioTrackShared.cpp
7c7be1e05634d96d08210efb4bdeb012ffba440d 20-Dec-2013 Glenn Kasten <gkasten@google.com> Fix some (but not all) unused parameter warnings

Change-Id: Ia99e23a0b46db3f3e6aa46f9018e63c14f4af369
/frameworks/av/media/libmedia/AudioTrackShared.cpp
2e422c472c91aa7912befd0fc038d1e11f354bc1 18-Oct-2013 Glenn Kasten <gkasten@google.com> Allow releaseBuffer after flush

After AudioTrack start checks for pending flush,
allow releaseBuffer on any previously obtained buffer.
For example, this can happen if the resampler has obtained
a buffer but not released the whole buffer yet.
Note that the resampler will be reading obsolete data.

Bug: 11285590
Change-Id: I0614fbb62e43604aac3089cce4b7797c87a306b5
/frameworks/av/media/libmedia/AudioTrackShared.cpp
cc21e4f1e41dfa17e7e2bef995fcd22c45f6bcd0 17-Oct-2013 Eric Laurent <elaurent@google.com> AudioTrack: fix head position after restore

The head position transfered to the new track
by restoreTrack_l() must take into account the frames that
are dropped from the old track to avoid a non recoverable
offset in the playback head position returned to applications.

Bug: 11230062.
Change-Id: I51143a08b95e8f264ed709ae2054360315f2b8b1
/frameworks/av/media/libmedia/AudioTrackShared.cpp
ce8828a016b082f730152af2204b8ea3610dc1ec 17-Sep-2013 Glenn Kasten <gkasten@google.com> Fix underruns when fast track denied due to SRC

OpenSL ES requests a fast track. If sample rate conversion is needed,
the request is denied by server, and a larger client buffer is used
to handle the higher latency of a normal track. However the client
notification period was calculated based on buffer being divided into
2 sub-buffers. That resulted in the notification period being too long.
The server pulls chunks that are smaller than half the total buffer.
So now the client uses 3 sub-buffers when there is SRC.

Also removed the 'defer wake' optimization because it was incorrect.
This optimization attempted to reduce the number of wakeups of client,
when server releaseBuffer knows that another releaseBuffer will be
following. But there is no way for the first releaseBuffer to predict
how soon the second releaseBuffer will occur. In some cases it was
a long time, and the client underran. So now the client is woken up
immediately if the total number of available frames to client is >=
the minimum number the client wants to see (the notification period).

Also fix bug where minimum frame count was not being used in the
calculation of notification period.

Bug: 10342804
Change-Id: I3c246f4e7bc3684a344f2cf08268dc082e338e2a
/frameworks/av/media/libmedia/AudioTrackShared.cpp
82aaf94a5b18939e4d790bbc752031f3070704a3 18-Jul-2013 Glenn Kasten <gkasten@google.com> Report underruns for fast tracks also

This fixes a regression that was introduced earlier
by commit 9f80dd223d83d9bb9077fb6baee056cee4eaf7e5
called "New control block for AudioTrack and AudioRecord".
That commit broke underrun reporting for fast tracks.

Also remove Track::mUnderrunCount, which counted the number of underrun
events, and was only used by dumpsys media.audio_flinger.

Now dumpsys media.audio_flinger reports the number of underrun frames,

Isolated underrun-related control block accesses via the proxy, so that
the server is not directly poking around in the control block.

The new proxy APIs are AudioTrackServerProxy::getUnderrunFrames() and
AudioTrackServerProxy::tallyUnderrunFrames(). getUnderrunFrames() returns
a rolling counter for streaming tracks, or zero for static buffer tracks
which never underrun, but do a kind of 'pause' at end of buffer.
tallyUnderrunFrames() increments the counter by a specified number of frames.

Change-Id: Ib31fd73eb17cbb23888ce3af8ff29f471f5bd5a2
/frameworks/av/media/libmedia/AudioTrackShared.cpp
d054c32443a493513ab63529b0c8b1aca290278c 12-Jul-2013 Glenn Kasten <gkasten@google.com> Move control block mName to createTrack() output

This is part of a series of CLs to clean up the shared memory
control block, by removing any fields that don't have to be there.

Change-Id: I6e51003a1293b6800258c31b22cff2eba42162e7
/frameworks/av/media/libmedia/AudioTrackShared.cpp
96f60d8f04432a1ed503b3e24d5736d28c63c9a2 12-Jul-2013 Glenn Kasten <gkasten@google.com> Rename control block flags to mFlags

Change-Id: I7b6d31e24531954ab1ecdf3ed56c19433700bd89
/frameworks/av/media/libmedia/AudioTrackShared.cpp
f20e1d8df84c5fbeeace0052d100982ae39bb7a4 12-Jul-2013 Glenn Kasten <gkasten@google.com> Rename control block server to mServer and add comments

Change-Id: Ieabd91acee92d0e84e66fbd358df5282b856306e
/frameworks/av/media/libmedia/AudioTrackShared.cpp
b1a270d1e926fb9a01b4265a7675ed0c2c8f4868 14-May-2013 Richard Fitzgerald <rf@opensource.wolfsonmicro.com> libmedia: offloaded playback support

- start() returns a status so that upper layers can
recreate a non offloaded track in case of error.

- Added states to handle offloaded tracks specific:
- waiting for stream end (drain) notification by
audio flinger
- allow pause while waiting for stream end notification

- getPosition() queries the render position directly from
audio HAL.

- disable APIs not applicable to offloaded tracks

- Modified track restoring behavior for invalidated
offloaded tracks: just send the callback and wait for
upper layers to create a new track.

- Added wait for stream end management in audio track client
proxy. Similar to obtainBuffer and should be factored in.

Change-Id: I0fc48117946364cb255afd653195498891f622bd
Signed-off-by: Eric Laurent <elaurent@google.com>
/frameworks/av/media/libmedia/AudioTrackShared.cpp
bfb1b832079bbb9426f72f3863199a54aefd02da 07-Jan-2013 Eric Laurent <elaurent@google.com> AudioFlinger: offload playback, non-blocking write

- Added specialized playback thread class for offload playback,
derived from directoutput thread.
This thread type handles specific state transitions for offloaded
tracks and offloading commands (pause/resume/drain/flush..) to audio HAL.
As opposed to other threads, does not go to standby if the track is paused.

- Added support for asynchronous write and drain operations at audio HAL.
Use a thread to handle async callback events from HAL: this avoids locking
playback thread mutex when executing the callback and cause deadlocks when
calling audio HAL functions with the playback thread mutex locked.

- Better accouting for track activity: call start/stop and release Output
methods in audio policy manager when tracks are actually added and removed
from the active tracks list.
Added a command thread in audio policy service to handle stop/release commands
asynchronously and avoid deadlocks with playback thread.

- Track terminated status is not a state anymore. This condition is othogonal
to state to permitted state transitions while terminated.

Change-Id: Id157f4b3277620568d8eace7535d9186602564de
/frameworks/av/media/libmedia/AudioTrackShared.cpp
ce177bb31493d3cd4450f9d4760fa1fd32ec6bf4 11-Jul-2013 Glenn Kasten <gkasten@google.com> Merge "AudioTrackShared cleanup"
050501d11d944dcb256d37d3b86bd658d94f6a7f 11-Jul-2013 Glenn Kasten <gkasten@google.com> Fix AudioTrack::flush()

It was only flushing at a surface level, and even then only the first time
the server observed the client's flush request. Now it flushes at a
deeper level, but there may be even deeper device-specific flushing.

Bug: 9770947
Change-Id: I687cc3410ff9e5e5d4a5dcb9e3b129501e53d247
/frameworks/av/media/libmedia/AudioTrackShared.cpp
7db7df0e8d9d7cee8ba374468cdbfa0108e3337c 26-Jun-2013 Glenn Kasten <gkasten@google.com> AudioTrackShared cleanup

Maintain unreleased frame count on client side also (was already there on server side).
Assertion failure instead of BAD_VALUE status for incorrect usage of APIs.
Clean up error handling code.

Change-Id: I23ca2f6f8a7c18645309ee5d64fbc844429bcba8
/frameworks/av/media/libmedia/AudioTrackShared.cpp
93bb77da5481ab75c2cd6e3aa681839273c6e43d 24-Jun-2013 Glenn Kasten <gkasten@google.com> Workaround AudioRecord bug for large buffer sizes

Bug: 9556436
Change-Id: I92d1238b623d2cfd648e0a684d0e710fb0bd8b43
/frameworks/av/media/libmedia/AudioTrackShared.cpp
0d09a9bec07b3bec78bd473ff0bfcf0a261f3f25 24-Jun-2013 Glenn Kasten <gkasten@google.com> Use mFutex as an event flag rather than semaphore

An event flag can be more fault-tolerant in case of loss of synchronization,
as it cannot overflow. It also allows more bits to be used in the future.
See http://en.wikipedia.org/wiki/Event_flag

Change-Id: I01ca25d951eb263124da54bb4738f0d94ec4a48b
/frameworks/av/media/libmedia/AudioTrackShared.cpp
9f80dd223d83d9bb9077fb6baee056cee4eaf7e5 19-Dec-2012 Glenn Kasten <gkasten@google.com> New control block for AudioTrack and AudioRecord

Main differences between old and new control block:
- removes the mutex, which was a potential source of priority inversion
- circular indices into shared buffer, which is now always a power-of-2 size

Change-Id: I4e9b7fa99858b488ac98a441fa70e31dbba1b865
/frameworks/av/media/libmedia/AudioTrackShared.cpp
e3aa659e9cee7df5c12a80d285cc29ab3b2cbb39 04-Dec-2012 Glenn Kasten <gkasten@google.com> Start isolating control block accesses in a proxy

The proxy object will eventually be the only code that understands the
details of the control block. This should make it easier to change the
control block in the future.

Initial set of control block fields that are isolated:
- sample rate
- send level
- volume

Prepare for streaming/static separation by adding a union to the control
block for the new fields.

Fix bug in handling of max sample rate on a track. It was only checking
at re-configuration, not at each mix.

Simplify OutputTrack::obtainBuffer.

Change-Id: I2249f9d04f73a911a922ad1d7f6197292c74cd92
/frameworks/av/media/libmedia/AudioTrackShared.cpp
a8190fc518b6769257896605f3aee091aeb60b50 04-Dec-2012 Glenn Kasten <gkasten@google.com> Split off the current control block to separate file

Prepare for a new implementation of step() etc.

Change-Id: I268421976ba577aa1fb5d7015de5441c05861190
/frameworks/av/media/libmedia/AudioTrackShared.cpp