History log of /frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
453b68a9b8de644361f7b95d66e9c4e29a275f2f 05-Jun-2017 Paul Mclean <pmclean@google.com> Merge "fix b/62040757 - bad pointer to native audioplayer in 32-bit builds." into oc-dev
ebdc77a0a617a1112de28822de7219762d114294 05-Jun-2017 Paul McLean <pmclean@google.com> fix b/62040757 - bad pointer to native audioplayer in 32-bit builds.

Forcing a (jlong) to always be passed to the JNI function.

Bug: 62040757
Test: CTS
Change-Id: I463385d49b88fb18221a3f874c209299a5f24b67
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
d73b1134e795fa521e71dc567b6b3bde9cdd498d 31-May-2017 Eric Laurent <elaurent@google.com> refactor native IPlayer implementation

Move native IPlayer interface implementation to libaudioclient
and use this implementation for OpenSL ES buffer queue player

Bug: 62027849
Test: verify regressions with OpenSL ES buffer queue player
Merged-In: I9f766c6a6c9912668e1ea07ec62070c5602660a9

Change-Id: I9f766c6a6c9912668e1ea07ec62070c5602660a9
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
c8a305bcafc009615270a30186b711fc33f85b91 28-Feb-2017 Jean-Michel Trivi <jmtrivi@google.com> Fix engine and player release code paths

Engine: do not call in-place destructor.
AudioPlayer: do no release the IAudioManager of the engine

Test: see bug
Bug: 34810287
Change-Id: I883e3d1f7dbaf641f7b1576d36e6ea39705dfe42
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
d2195fb3559e334f543ded7da2f9a87e10e89c40 01-Feb-2017 Jean-Michel Trivi <jmtrivi@google.com> AudioPlayer: combine SL volume with IPlayer volume and pan

Always combine the SL ES player volume with left and right
volume multiplier coming from the IPlayer interface for
pan and volume.

Test: adb shell clpac 0, then control pan/vol of an SL player
Bug 30258418

Change-Id: I493528efe2e517650429e79dd7ddc8baf7ae773b
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
e49fde799fbeafee0d8ba905c1b7fbe4bc639cac 31-Jan-2017 Jean-Michel Trivi <jmtrivi@google.com> Fix player destruction after failed initialization

In case of a failure in IEngine_CreateAudioPlayer, the mTrackPlayer
field of a CAudioPlayer is not initialized, which will
cause a crash if destroy() is called on the player.

Test: run cts -m CtsMediaTestCases -t android.media.cts.AudioNativeTest#testOutputChannelMasks
Bug 34722995

Change-Id: Ia7e62779c9698581ef000c48c7ba137a5bf0c219
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
67213e9075e0c51ed39142553facae586295dcaa 15-Jan-2017 Jean-Michel Trivi <jmtrivi@google.com> OpenSL ES AudioTrack-based player implements IPlayer

Encapsulate the AudioTrack object inside a container for
it along with an implementation of IPlayer.
Note that at this point the piid and audiomanager reference
are still stored respectively in CAudioPlayer and Engine,
only for PLAYER_TYPE_SLES_AUDIOPLAYER_URI_FD players, to be
consolidated inside GenericPlayer class.

Test: use vendor/google_toolbox/team/audio/cmds/ClPlaybackActivity
Bug 30258418

Change-Id: I88163b05fa1b962b166c5dc33da018ee320ab70a
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
143c8939640425ce28aaac46732fb604fba1f5c8 22-Dec-2016 Jean-Michel Trivi <jmtrivi@google.com> OpenSL ES audio players are accounted for in AudioService

Track activity of AudioPlayer instances that play audio,
i.e. those with an AudioTrack. Assign them a player
interface ID, and report their state through
the native interface for AudioService.

Test: launch app using SL ES and dump AudioService
Bug: 30955183

Change-Id: I02dc0a34779b08f44d7c58b010932e1c6335b415
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
677c796097b542e9ee6cf43a59e754f43c2370dc 29-Jun-2016 Eric Laurent <elaurent@google.com> Fix pre processor interfaces implementation

- Fix SL_IIDs for AEC, NS and AGS interfaces to match actual
effect type GUIDs.
- Remove IsAvailable() method which did not work because the interface
could not be exposed anyway if the effect was not present
on the device. Also the implementation was linking directly against
the effect factory which is not allowed in non priviledged processes.
- Make pre processor interfaces EXPLICIT instead of OPTIONAL.
- Exit early in AudioRecorder realize if the native AudioRecord creation
fails.
- Add native AudioTrack cleanup in case of error in AudioPlayer realize().

Bug: 4999001

Change-Id: I6235248234491eaa9723cde9de85b965c031571d
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
8c9071f491393fadf767b6164a17b0795eba3fda 02-May-2016 Eric Laurent <elaurent@google.com> Add configuration option for performance mode

Performance mode tells the framework how to configure the audio path
for a player or recorder according to application performance and
functional requirements.
It affects the output or input latency based on acceptable tradeoffs on
battery drain and use of pre or post processing effects.

Bug: 20825626
Bug: 17981873

Change-Id: I0e79cf2da03b4bfa2080fe6d4ea9d8753ffe3497
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
2ab5ad96f9ddbf44378546d132dd98a9265a349f 13-May-2016 Glenn Kasten <gkasten@google.com> Don't specify sub-buffer count for non-fast tracks

Bug: 28695447
Change-Id: I81bfd3a02c9600e3f1d9abc68bb2d70d45112260
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
f930011635e970346ca31d0509a173a695023f27 18-Apr-2016 Glenn Kasten <gkasten@google.com> Allow OpenSL ES to specify a total buffer size for a fast track

by using the OpenSL ES buffer count to indicate the number of
notifications (sub-buffers) per track buffer.

Bug: 27819623
Change-Id: Idd782e971eb415298ea5b47a6f5d39b1bdd5c7fc
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
b30330217356d0e10abe5220662424231dc57880 17-Mar-2016 Glenn Kasten <gkasten@google.com> Merge "Use audio_session_t consistently" into nyc-dev
15f1e492e8fe7e2b6665009b5facd2b42913ab0f 10-Mar-2016 Paul McLean <pmclean@google.com> Native routing phase 4

Allow Acquire before Realize

Bug: 23899814

Change-Id: I27682ecb5259fc6ebbe3eca5c6aba5d956aa42bb
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
213c31153b9bda7b5a091f2996da7b655c8ed451 08-Mar-2016 Glenn Kasten <gkasten@google.com> Use audio_session_t consistently

Bug: 27562099
Change-Id: Ie04efb44923fdd2f034b771157fa30dababdfb58
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
84017464b6c273771743cdcc274135908c7e8a79 27-Feb-2016 Glenn Kasten <gkasten@google.com> Add use for audio_unique_id_t

Bug: 25641253
Bug: 21019153
Change-Id: I795a013cad2cf1ba85eb7079bf4d994612ce18b8
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
62496886cb4620c09bc5df0de70a883319616c25 22-Feb-2016 Aurimas Liutikas <aurimas@google.com> Enable -Werror and fix warnings in frameworks/wilhelm.

Bug: 27147881
Change-Id: I5e767007d85a160864a606926ee81adb94eae899
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
28340d1d9199b789f0db015680b008c98084f0b7 12-Feb-2016 ilewis <inl@google.com> Emulating old channel mask behavior for both input and output

This adds the "ignore positional channel masks" behavior back
into output as well as input.

Bug: 27042146
Change-Id: I51fc4a4494cd9477fdcddb6901cd353b88ea2c2e
(cherry picked from commit f4f89da331441ec4693c8ebb6ae3cf5460a22328)
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
4e8fe8a60c3aa8085918f15f281e0979682aefdc 13-Nov-2015 Paul McLean <pmclean@google.com> Fixed validation and translation for indexed channel masks

The channel mask validation code had a number of built-in
assumptions around positional masks. Most of these assumptions
are invalid for indexed masks.

The translation between OpenSLES channel masks and Android
channel masks also needed reworking; this CL attempts to
do it the right way by calling helper functions rather than
setting bits directly.

Bug: 23899736
Change-Id: I65b024b71e3267d2e9ca316ac74771e16462e134
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
b4e379dd5a7dc764260ace7b73a782077ff10232 20-Aug-2015 Glenn Kasten <gkasten@google.com> Force RAW to reduce latency on platforms that support it

Bug: 10546170
Change-Id: Ida0d060b6b777ff5c920224f051e8ea557ff6c18
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
4e384ca65e5fd3eabac0621bed98f937d8a263c5 10-Jun-2015 Glenn Kasten <gkasten@google.com> Merge "Check sample size in addition to container size" into mnc-dev
26f9a1c4c14b0f7da8b0d60ffcecbf5e221d15c5 09-Jun-2015 Eric Laurent <elaurent@google.com> Merge "Use only strong references to AudioEffect" into mnc-dev
aa08cb01d58f1da2d0a2b208aed3bf1730f8f63d 05-Jun-2015 Eric Laurent <elaurent@google.com> Use only strong references to AudioEffect

Do not use raw pointers to native AudioEffect objects.

Bug: 21629892.

Change-Id: Ib6af552503584c5f0532ff6dee2829da6e10ac88
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
71065fbf12abafd4c2a0dc85c81f13b564ff69fb 04-Jun-2015 Glenn Kasten <gkasten@google.com> Check sample size in addition to container size

Also add comments and fix line length

Change-Id: Iaac8ade2b53c3cc6951dc94413bbe996e1d5e925
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
a80a6ff9a1f80792478c9d43578afa24a07eb2f0 04-Jun-2015 Glenn Kasten <gkasten@google.com> Only allow native byte ordering

Change-Id: Iebe0a9df03b988d84253aa74f6ef8392b337967c
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
df9b397f73d8f063ff66e0fbf86ced075fe6d5aa 04-Jun-2015 Glenn Kasten <gkasten@google.com> Remove redundant checks

Change-Id: I9f0f0063c3d8ba845c937aad97811d296ceaa494
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
ff25010cb77455a46357d6dd012631a2599d7bf4 04-Jun-2015 Glenn Kasten <gkasten@google.com> Start rewriting code that handles channel counts and masks

Change-Id: I700d719ee59c595b020979ecae56eb64bf657cca
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
09aeff183fa1353298c47fcb18ff33b0d08a990d 04-Jun-2015 Glenn Kasten <gkasten@google.com> Simplify code in android_audioPlayer_checkSourceSink()

Change-Id: I12bd19ca899dbcc8b3ef7c9a10cf871ad3ac49c5
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
abd09a98140420b6c861d30e30494cd769e745b7 30-May-2015 Glenn Kasten <gkasten@google.com> Merge "Whitespace" into mnc-dev
5d748826b90e8e3cdb740a220433fa60c6c9f31c 30-May-2015 Glenn Kasten <gkasten@google.com> Merge "Explicitly list all event types in switch for callback" into mnc-dev
88a4a5da5eb158fe00f17af581f7529884c0b474 30-May-2015 Glenn Kasten <gkasten@google.com> Merge "Allow playback of sample rates up to 192 kHz" into mnc-dev
9f3ac83aa036a780ca901f9ff75e47a5a7cbba1f 29-May-2015 Glenn Kasten <gkasten@google.com> Explicitly list all event types in switch for callback

Change-Id: I039ce75df2e6c483d09e7efd2d19303fc165c0d5
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
ac28eca1df49f581d952ffbda5d3019f7e3b7be6 29-May-2015 Glenn Kasten <gkasten@google.com> Whitespace

Change-Id: Ie9fa59703d90fa0a6d4b83d6d5bd637f53d4058c
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
b8fe327b1505778e82db76de930dd3f62ec99158 28-May-2015 Glenn Kasten <gkasten@google.com> Remove redundant parentheses

Change-Id: Ia7de3564a8065f33aa74655b01357f4138b32aa8
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
04e38178473bb0ffdb4759956db60dd86aa7e732 22-Jul-2011 Glenn Kasten <gkasten@google.com> Add static for methods only used locally

Change-Id: I5e7d5c93869b31f75efc9fd3f040df82b67d9efd
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
e05f49175a60182d29d0e38ee2a214854c279d95 28-May-2015 Glenn Kasten <gkasten@google.com> Add const

Change-Id: Ide3011e14c8a4c5c0d29db77e7c99789c37c30a7
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
45c7c53181a1b10223fa8708432c31c4be4496a3 28-May-2015 Glenn Kasten <gkasten@google.com> Allow playback of sample rates up to 192 kHz

The check for non-common sample rates is still present in data.c

Bug: 21501319
Change-Id: Iffb3c962004d2a0fe1ec1b2cc9ee0ebf943f142b
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
64c3fe7bd86951eeac27adca2219ce16eabff58c 28-May-2015 Glenn Kasten <gkasten@google.com> Whitespace

Change-Id: I666963a80530aceec9f47e625018844daf29c017
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
baa2db446c404a4443a8e455a412753fc92ed036 28-May-2015 Glenn Kasten <gkasten@google.com> Explicitly compare raw pointers to NULL

Change-Id: I6e867fea4067e0e0497d91c0750bbdcbe44d7f7a
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
03d4a5ae486538839d02ae8a18e2a5c38bf1e2fb 28-May-2015 Glenn Kasten <gkasten@google.com> Remove redundant semicolon

Change-Id: Ida3b82c09164e3bbf99d36b3cbd8607a9eefb45c
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
2dc0674aba6242c677365b675795773738397ab9 13-May-2015 Glenn Kasten <gkasten@google.com> Clear mAudioRecord on set() failure

All uses to mAudioRecord were already protected by checks for mAudioRecord != 0

Bug: 20818955
Bug: 20890069
Change-Id: I243205b99b198eb1b5a1a027b27cbb7d5aaaa8db
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
fe44276c433864352d96a9bc2e9abf676b725a34 18-Nov-2014 Raph Levien <raph@google.com> am 0f6da1a2: Reduce audio output latency

* commit '0f6da1a299c8dd924d19714ee69d343915c32d2c':
Reduce audio output latency
0f6da1a299c8dd924d19714ee69d343915c32d2c 14-Nov-2014 Raph Levien <raph@google.com> Reduce audio output latency

This patch reduces latency in the OpenSL ES player path by calling the
callback immediately before data is consumed, rather than after.

Bug: 12246268
Change-Id: I8273b4a03f16011beec21dd52545f8ad1a25fd95
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
769b5d55d6733e02dc9ea36c3922ba3880838c9c 10-Nov-2014 Glenn Kasten <gkasten@android.com> Merge "Check that the ABQ mime type matches the expectations"
d0081ece36dcb6ecdadeb9fc0ee912cffb7effc7 28-Jul-2014 Eric Laurent <elaurent@google.com> rename AudioSystem::newAudioSessionId()

Rename AudioSystem::newAudioSessionId() to
AudioSystem::newAudioUniqueId() as it can be used
also for I/O handles.

Bug: 12378680.

Change-Id: I5f0eaaadc21ff2aacf81670490ad42c54537d86b
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
d03d766459462a0f86a800ac4cc0cecb05e97beb 02-Jul-2014 Eric Laurent <elaurent@google.com> audio: fixed channel count determination from channel mask

Do not use popcount() to derive channel count from channel mask.

Bug: 15000850.
Change-Id: I7af794e4515cd0f85e5b9744bd4e53e33aa0d5eb
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
e57c13397185f9ad0f162855e9a8ebeb0c94bfc4 24-May-2014 Andy Hung <hunga@google.com> Add float playback capability to OpenSL ES

Add SLAndroidDataFormat_PCM_EX to match OpenSLES 1.1 header file,
together with related SL_ANDROID_PCM_REPRESENTATION_* constants.
Use slesTest_playbq as the test application.

Change-Id: I04bcd170f5c517051a799bacf8f52da5f1353ad6
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
36c0711b6919c2185a4d6e514d7f421b0d9c7bc6 27-May-2014 Martin Storsjo <martin@martin.st> Check that the ABQ mime type matches the expectations

The code in audioPlayer_getAndroidObjectTypeForSourceSink assumes
that an android buffer queue source combined with an output mix
sink is an mpegts source, while it it assumes that it is an adts
source if it is combined with a simple buffer queue sink. This
assumption never was verified before, making the set up actually
seem to succeed even though the data is interpreted as the wrong
format.

Change-Id: I7e031ec8139fa2d770737935eb9acd3506d3fa3f
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
c323fec2a2639c0cf7463016d592d0eb0539657c 24-May-2014 Andy Hung <hunga@google.com> Add 24 bit and 32 bit playback capability to OpenSL ES

slesTest_playbq is the test application.

Change-Id: Iaa453471d2e9ff4e6b11ac5c68690993179fea2b
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
76de029ec49b535ca8aa3aef777d0dfb1838889e 24-May-2014 Andy Hung <hunga@google.com> Add mono to android_audioPlayer_validateChannelMask

Change-Id: I898401a1a0b6081dc0d4e9d41be09cb38c675951
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
bb74f23cd3dc877c7eaf4db2132f724d11aeeb8f 15-May-2014 Paul McLean <pmclean@google.com> Initial Implementation of new NDK audio formats

Support for 24-bit audio formats - Support for Quad, 5.1 and 7.1
multi-channel output

Change-Id: I4e4f5d2915a43970ae01f552ba506591902aa070
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
92e53bc98cd938e9917fb02d3e5a9be88423791d 16-Mar-2013 Glenn Kasten <gkasten@google.com> Remove requirement for application side double-buffering

At one time it was thought that application side double-buffering was
required for fast tracks to work reliably. It now appears that this
was overly conservative, and that fast tracks work just fine with
single buffers on application side. This is because the moment after
FastMixer pulls the data from the fast track, it synchronously signals
the application's callback thread to wake up, which will then run the
buffer completion callback handler to re-fill the buffer. So disabling
this check now.

Bug: 9276275
Change-Id: I2c74a8c6d752140ccc7d285c5c5c1f7fcd792650
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
b42e943393b119b42b8fdca29be067800c35c78e 13-Nov-2012 Glenn Kasten <gkasten@google.com> Remove dead code android_getMinFrameCount

Change-Id: I1d4779a822e024bb8ae77eff153183bfb6a07b12
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
91145ef159d3e165a461cbd76341ff8ed3d72bae 04-May-2012 Jean-Michel Trivi <jmtrivi@google.com> Playback rate on OpenSL ES AudioPlayer playing from URI/FD

Allow AudioPlayer to use the platform's 500-2000 range (in
permille) of playback rate for audio when the data source
is a URI or FD.
Since play events for those players are simulated through
monitoring the playback position, scale the time
between updates so play events are delivered in content
time, not presentation time (as defined in OpenSL ES
specification, "positions do not scale with changes in
playback rate").

Bug 5898620

Change-Id: Ib512caebd7f3983c9e845be62e48dfee8499e59c
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
8daa09a2af477dbe495839ccf806919a02aa53cd 18-Apr-2012 Eric Laurent <elaurent@google.com> rename audio policy flags

Change-Id: I652fc4cfe6cc9a273234256e20f0b706182e2e27
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
78e61e01307d62bd04283ada99ce5df1c647810d 04-Apr-2012 Glenn Kasten <gkasten@google.com> Updates to Wilhelm's use of fast tracks

Move volume and mute/solo interfaces from blacklist to whitelist.
Remove hard-coded frame count; this is now done at a lower level.

Change-Id: Ie9b48941df799dd8cba45dc7015d62e5adb76f5d
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
7880f29c5ae58e0dd5ac67753049acc8888cb5f5 27-Mar-2012 Glenn Kasten <gkasten@google.com> Fast tracks

Change-Id: I7ab4d843be5bfe759cea8330ab0ede46e236adaf
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
ee3ad477a71ba690f0b5721056a6514bf2f76bd8 16-Mar-2012 Glenn Kasten <gkasten@google.com> Merge "Fix indentation and redundant whitespace"
1f41f98a87ee3d0070a794d8e8905e7d9d03d755 07-Mar-2012 Glenn Kasten <gkasten@google.com> Use audio_policy_output_flags_t consistently

Change-Id: Ie487ac0776e9bc6f12907945ec9bea0730200ad1
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
24c770c9d328ac5516b488e00c77d6c76d13bcfc 17-Jan-2012 Glenn Kasten <gkasten@google.com> Merge "Use audio_stream_type_t consistently"
0bfed90f3b312f7c8f2b744efcf62f1992661d6c 06-Jan-2012 Glenn Kasten <gkasten@google.com> Use audio_stream_type_t consistently

Change-Id: I6c02c9b285a00cefefc5d90d655d92ca8690765a
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
a6c69c7e1665b38da8d6784e65210acbe501b92c 06-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/157065

Bug: 5449033
Change-Id: I270cbf7b920d5f2fbb5f345f3c88426697c4391d
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
4bcfac513e073db89f72e2345be365f95895ca28 20-Dec-2011 Glenn Kasten <gkasten@google.com> Merge "Cleanup CreateAudioPlayer and CreateMediaPlayer"
22ced1dc023dc000118e3a26517b14e9babd7c5a 12-Aug-2011 Glenn Kasten <gkasten@google.com> Fix indentation and redundant whitespace

Change-Id: I8e0193ad5aa9405f64203bf7814d8a9e434c5dde
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
72042d4448cee63528c619537321ba73944c6382 16-Nov-2011 Glenn Kasten <gkasten@google.com> Cleanup CreateAudioPlayer and CreateMediaPlayer

Fix minor bug in MediaPlayer, it was missing an assignment if invalid locator:
mp->mAndroidObjType = INVALID_TYPE;

Cleanup:
- add placeholders for android::AudioSystem::acquireAudioSessionId and
releaseAudioSessionId
- remove duplicate initialization of some fields.
- android_audioPlayer_create can never fail, so make it return void
- add comments
- remove unused method audioPlayer_setInvalid
- simplify android_audioPlayer_create

Change-Id: I237b796f6b828cf53bf2c628e52a05a4bdf86c06
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
ca426f63e9c900ecbd28f8e3037aaf47ef739dd4 03-Oct-2011 Glenn Kasten <gkasten@google.com> Consistent formatting for if (

Change-Id: I4213dbe94c7dbc95565a20d12d66eb16707d0caa
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
ae1a5c8dc1fccf7c121eda830f8d23bd094c0f16 15-Nov-2011 Glenn Kasten <gkasten@google.com> Remove AudioTrackProxy since AudioTrack is RefBase

Change-Id: I4a1f755178699e0fdedf58e1f3cbd82e6067e071
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
70e6a0238597223221a8bf5e506c92acf28aa35f 29-Sep-2011 Glenn Kasten <gkasten@google.com> Simplify code for the AAC decode use case

Details:

AacBqToPcmCbRenderer constructor
now takes an additional parameter: the IAndroidBufferQueue * interface.

So now there is no need to register a callback after construction,
and AacBqToPcmCbRenderer::registerSourceQueueCallback
can be deleted.

This allows android_audioPlayer_androidBufferQueue_registerCallback_l
to be deleted.

AacBqToPcmCbRenderer::mBqSource is always non-NULL and const, so this
allows removal of mBqSourceLock and some error-checking code.

BufferQueueSource source constructor now takes the IAndroidBufferQueue *
interface instead of the list [user, context, caller].

This allows mAndroidBufferQueueSource to be const, which then allows
more code to be deleted in IAndroidBufferQueue_RegisterCallback.

new AacAdtsExtractor can't fail.

Change-Id: I1f39ccc1e69833fe6df616feb76edbe4ce82fca7
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
86d4c6adc589ad73ff38e480151e65e755a7071a 14-Nov-2011 Glenn Kasten <gkasten@google.com> am e75ba3ef: Merge "Bug 5201321 recover from mediaserver crash" into ics-mr1

* commit 'e75ba3eff247622fdf36974d2216dcaff269ea5c':
Bug 5201321 recover from mediaserver crash
513222822545c3e954176476b263df52a47f43a4 10-Nov-2011 Glenn Kasten <gkasten@google.com> Bug 5201321 recover from mediaserver crash

Add a media player death notifier to recover from media server crashes.
Downgrade some logs.
Destructors should be protected.

Change-Id: I7774733bcb12fc7fbfe237bdbeffca1adde46e78
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
7f250a17c145382b866d5d4d7ef23d65fada6236 30-Sep-2011 Glenn Kasten <gkasten@google.com> MediaPlayer kEventPrepared similar to AudioPlayer

Now that AudioPlayer kEventPrepared logic for successful/unsuccessful
prepare completion has been combined, make MediaPlayer work the same
way. This will make it easier to merge similar code AudioPlayer and
MediaPlayer in an upcoming CL.

Change-Id: Iaa58dcc85b0ede82036c0a5f45d61d0e7853fe0b
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
e2e8fa36bd7448b59fbcdf141e0b6d21e5401d91 29-Jul-2011 Glenn Kasten <gkasten@google.com> Comments

Change-Id: I1592d1979ce5f5811ff5a47b4b60db93e8670313
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
167a2af67dcc0d20e6e3e995a23a0567715e0ee1 07-Oct-2011 Glenn Kasten <gkasten@google.com> AudioPlayback_Parameters cleanup

Use AudioPlayback_Parameters more consistently in parameter list of
constructors. Also, StreamPlayer::StreamPlayer was over-assigning to
mPlaybackParams (already assigned by its superclass's constructor).

Move initialization of AudioPlayback_Parameters from each case
to before the switch, as it is shared by each use case.

Remove old asserts.

Change-Id: I8925d36da031c80308457c7e940418d3a4e47b62
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
b6aed97f98afa0c20f5b1e854ac07ccacfcdacc6 28-Oct-2011 Glenn Kasten <gkasten@google.com> am d0b07222: Merge "Bug 5526807 inform client of errors after prepare" into ics-mr0

* commit 'd0b0722276aea9a06a118a64abfc8b3e9498e931':
Bug 5526807 inform client of errors after prepare
5e4d65e369f28746767aba11b618dee314bb8197 27-Oct-2011 Glenn Kasten <gkasten@google.com> Bug 5526807 inform client of errors after prepare

Change-Id: Ic5c88f8e1c8e7d6226a7a71a2a89a70f0fa876f8
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
c3b82a293ed06001ba6d50f111608160c6065ef2 18-Sep-2011 Glenn Kasten <gkasten@google.com> Final revisions for NDK API level 14

Rename ANDROID_MIME_MP2TS to XA_ANDROID_MIME_MP2TS and
ANDROID_MIME_AACADTS to SL_ANDROID_MIME_AACADTS and make public.
ANDROID_MIME_AACADTS_ANDROID_FRAMEWORK remains private.

Change-Id: Ie2cda273b6adb2db453aad188b28e64147f9e6b0
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
f5d4ad08eb6318676651f5b026ed8ddd85d122e7 10-Oct-2011 Glenn Kasten <gkasten@google.com> Merge "AudioPlayer kEventPrepared"
dfc864b1f84f1d050763cf84109b9fdca4415bba 10-Oct-2011 Jean-Michel Trivi <jmtrivi@google.com> Merge "Fix bug 5374629 Can't create AudioPlayer playing from MP2TS ABQ"
796eb075da9c84c5479bdd4dedd9c46c632e8e60 30-Sep-2011 Glenn Kasten <gkasten@google.com> AudioPlayer kEventPrepared

Combine execution paths for successful and unsucccessful paths of
android::GenericPlayer::kEventPrepared: for AudioPlayer to make it easier
to see the similarities and differences (and make some other changes soon).

Remove old asserts.

Change-Id: I59304d368a9b7611f2a16c1c687cf8d827526b58
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
779a533785a4b8d2521123bc3c0a035b93ba078d 30-Sep-2011 Jean-Michel Trivi <jmtrivi@google.com> Fix bug 5374629 Can't create AudioPlayer playing from MP2TS ABQ

An AudioPlayer playing audio coming from MP2TS data stored in an
AndroidBufferQueue couldn't be created and realized anymore due
to:
- a regression that prevented an OutputMix to be used as the
sink of an AudioPlayer that had an ABQ as a data source
- a missing update when the Realize() method became fully
locked on the object, android_audioPlayer_realize() was
still trying to lock the already locked AudioPlayer.
Both issues are covered by a CTS test.

Also verify the SLSeekItf is not required when using an ABQ
source.

Change-Id: Ibb1b753dcce59b7cf23ba118e287349e00e7fff4
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
c0a40f3efef1706f861777ff68003fe344730055 28-Sep-2011 Glenn Kasten <gkasten@google.com> Remove dead code

Change-Id: Ic68d4d7b942ef99120ad30ee3ef7ce48ff1d697a
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
3ac5dcc05fe321e4f01918aef2e3e54e22c9a5c1 17-Sep-2011 Glenn Kasten <gkasten@google.com> Remove dead code

AudioPlayback_Parameters fields trackcb and trackcbUser
audioTrack_callBack_uri
android_Player_androidBufferQueue_registerCallback_l
GenericPlayer field mLooperPriority
StreamPlayer::registerQueueCallback
CAudioPlayer::mpLock
AudioSfDecoder::startPrefetch_async
IAndroidBufferQueue does not support AudioRecorder object
android/BufferQueueSource.h #include

Change-Id: I9d7cef243167e10279df452e7c62e66d8f5fe3b6
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
f4b45a37248899ae2d27bb172f8387fbf1edff8e 12-Sep-2011 Glenn Kasten <gkasten@google.com> Bug 5090073 Callback protectors

Add callback protector for decode to PCM usage cases.
Move callback protection up earlier for URI decode use case only.

Other:
Remove redundant mCallbackProtector field.
Optimization: on exit from callback protector, only broadcast if !mSafeToEnterCb,
that is if destroy has requested callback protectors to finish up.
More callback protector logging.
Add callback protector requestCbExit() [no wait], not yet used.

Unrelated:
3rd parameter of adecoder_writeToBufferQueue is always CAudioPlayer * instead of void *.

Change-Id: I57a46acf0e5ecb213540b13ca08098177ad7ad6e
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
f66b430471d691de4bf7b6bbc1a6527897f61cbd 17-Sep-2011 Glenn Kasten <gkasten@google.com> Set mAndroidObjState to ANDROID_READY once

The mAndroidObjState field should only be set to ANDROID_READY once,
after prepare completes either successfully or unsuccessfully.
Remove a couple of redundant assignments.

Change-Id: I4b73bc94aea4f8d4afc1111d7fcdccce4bf8a92d
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
7133228a478e16458b659946f2180ecddd13fda7 09-Sep-2011 Glenn Kasten <gkasten@google.com> Bug 5287555 create StreamSourceAppProxy once

Create StreamSourceAppProxy once in the StreamPlayer constructor,
rather than dynamically in StreamPlayer::registerQueueCallback.
As StreamPlayer::registerQueueCallback can be called multiple times
(or even not at all), this guarantees we always have only one
StreamSourceAppProxy that never changes.

Also fix bug where we weren't using a stream protector for AudioPlayer
with MPEG-2 TS AndroidBufferQueue data source (we weren't calling
setCallbackProtector on it).

This has some unexpected side benefits of simplifying the code:
- remove unused parameters and member variables
- mAppProxyLock not needed since the callback protector is created early
- remove GenericPlayer::setCallbackProtector
- inline android_StreamPlayer_realize_l for the use case
AUDIOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE to be like MediaPlayer

Change-Id: I090c11cde9474285185481192dba2b5c01338a50
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
4260ff7b8f65fdfe8d0176cdce66faf0a10c4b10 10-Sep-2011 Glenn Kasten <gkasten@google.com> Bug 5287473 realize locks

Realize had inconsistent and partial locking.
Now realize runs completely locked by default.

Change-Id: If453cfc0ac874f32cf5a1fcfe7795d24bd2a48d4
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
bc0e642e6c1a51b3ae3a02d490d94b03e718e6b5 02-Sep-2011 Jean-Michel Trivi <jmtrivi@google.com> Fix 5249076 Don't let the shared memory buffer drain

Whenever pushing data to the shared memory from the
AndroidBufferQueue, post a message to do the same operation
again if there is still room in the shared memory. This
ensures the consumption of data will keep the
shared memory buffer full, not the notification of space
available in shared memory, which may happen while the
Android Buffer Queue is empty (after a clear() for
instance).

Change-Id: I397d70ebb927fa6a1d0fb97321a70db0440b96fe
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
f5ff1a75f55677163bd9a8bd804e8f5c33ef592c 30-Aug-2011 Glenn Kasten <gkasten@google.com> Bug 5244675 handle the switch cases of AAC decode

Fix handling of AUDIOPLAYER_FROM_ADTS_ABQ_TO_PCM_BUFFERQUEUE decode use case:
- Play::GetPosition: explicitly list decode case and return media
player time; previously returned zero.
- Seek::SetLoop for AudioPlayer or MediaPlayer: return
SL_RESULT_FEATURE_UNSUPPORTED on non-URI data source. This is
correctly passed up to app.

The remaining have no immediate impact, but should make future maintenance easier:
- Play::GetDuration: explicitly list decode case and return unknown time;
no impact as already covered by default.
- Seek::SetPosition: explicitly list decode case and handle as no-op; no
impact as already covered by default.
- Seek::SetPosition for AudioPlayer or MediaPlayer: return
SL_RESULT_FEATURE_UNSUPPORTED with unsupported data source e.g. buffer
queue. No impact as the result is currently ignored, but added a
FIXME to pass this up to app.
- AndroidBufferQueue::Clear: explicitly list decode case as a no-op
other than the partial clear of upper layer queue.
- AndroidBufferQueue::onRefilled: explicitly list decode case as
a no-op, but with a FIXME that this may need more work later.

Change-Id: I53c8a0b736f32cd265ee9c94a70127d4f80869b5
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
91540f92d7f1bcda423859af6bd82df083c2afab 28-Aug-2011 Glenn Kasten <gkasten@google.com> Bug 5226085 miscellaneous metadata issues

The metadata keys are now exposed for AAC decode.

The metadata keys are now exposed at Realize. The keys were previously
only available after prefetching was complete. This made it more awkward
for an application to use them.

Fixed race condition in access to metadata values.

Change-Id: I3daed2da61f5ed0add6948f1558963cfe66795fc
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
86cc74ab4534c4e4dc79a7cfda83815d7c95beb5 24-Aug-2011 Glenn Kasten <gkasten@google.com> Merge "Bug 5153313 keep compatibility of local files URI"
833251ab9e5e59a6ea5ac325122cf3abdf7cd944 11-Aug-2011 Glenn Kasten <gkasten@google.com> Bug 5153313 keep compatibility of local files URI

Also fix a bug in decode from fd to PCM buffer queue, where
we were closing the application's fd.

Change-Id: I220cd1c242f2f5e240b4dd1b9e8d79c88878bdcd
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
dd177e2d3923d4653eaa4226f07b89a999907970 02-Aug-2011 Glenn Kasten <gkasten@google.com> Bug 5105712 synchronous callbacks

After GetPosition is made synchronous, it is safer to make client
callbacks synchronous also.

Change-Id: I2688f709ed672aaa62d046d5f95db1b81504c9e3
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
8478d83d1e42e2b4e252cc7e7135fd872bb36982 24-Aug-2011 Glenn Kasten <gkasten@google.com> Merge "Bug 5198051 MediaPlayer prefetch status interface"
c623c89c0a32c5fc77c998f1742d58e7be69e8c1 22-Aug-2011 Glenn Kasten <gkasten@google.com> Bug 5198051 MediaPlayer prefetch status interface

Change-Id: I426c870f803df0a7052f17be955ba797a814b4cc
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
bcfe680db1e392f3bb29382c2e15e89c3af783ed 22-Aug-2011 Glenn Kasten <gkasten@google.com> Bug 5198051 MediaPlayer PLAYEVENT_HEAD* callbacks

Change-Id: Ibb04fbf727997281bb77fd22c51cd90bd044e505
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
1452b38f9f4a8a0d76c936c393c794f3995526b6 12-Aug-2011 Glenn Kasten <gkasten@google.com> 8-bit now works

Change-Id: I70ce7e10f0b465250b9f4d7644d21f5c4b4c99fa
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
ccabcf9073f0ccd12016ff1f05d1c4456c41b254 16-Aug-2011 Eric Laurent <elaurent@google.com> Merge "Bug 5147281 prefetch status deadlocks"
e3f648ad6e3634680452b639ee802c657fbfa73d 14-Aug-2011 Jean-Michel Trivi <jmtrivi@google.com> Merge "AAC buffer decode to PCM buffer queue"
a60dbf554549d10780f473b6e1373aa07aec3a28 11-Aug-2011 Glenn Kasten <gkasten@google.com> Bug 5147281 prefetch status deadlocks

Fixed two deadlocks related to AudioTrack prefetch event callbacks:
- if PrefetchStatus interface was initialized on an AudioPlayer,
there was a deadlock at the point where it checked whether to do a callback
- prefetch status callbacks are now called with the object unlocked,
so they are permitted to do APIs on the object

Miscellaneous fixes:
- SMP-safe locks for GetPrefetchStatus, GetFillLevel,
GetCallbackEventsMask, SetFillUpdatePeriod, GetFillUpdatePeriod
- SetCallbackEventsMask error handling for invalid bitmask
- Enqueue sets prefetch fill level to 1000

Change-Id: Ic8b2c440aeb4efa3446a4a73d3422d934ceb0578
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
bb832e853d4afb11b0a3287b2eb0cad87696d631 27-Jul-2011 Jean-Michel Trivi <jmtrivi@google.com> AAC buffer decode to PCM buffer queue

Implement AAC ADTS decode with buffers of compressed data being
passed to the framework through an AndroidBufferQueue, and
decoded PCM buffers being passed to the application through
a BufferQueue (just like existing decode from URI/FD).

Change-Id: Id992a44a5ca7e404088b929f2b0afe9ca1f85223
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
f093dcf23cb5f54ced676c03a64cc68a165266f4 09-Aug-2011 Glenn Kasten <gkasten@google.com> Merge "Bug 5126938 dependency and miscellaneous bug fixes"
70045723775b56440b4e10d948831a2190d2d264 09-Aug-2011 Glenn Kasten <gkasten@google.com> Merge "Bug 4603165 playback rate change"
c2a325746469c4c7625ec78a169b65a11dbe1e30 08-Aug-2011 Glenn Kasten <gkasten@google.com> Bug 5126938 dependency and miscellaneous bug fixes

Fixing bug 5126938 will involve adding the IAndroidConfiguration interface
to CMediaPlayer object. In the process of doing this, I found a few
miscellaneous bugs in the error handling for IAndroidConfiguration. This
CL fixes those bugs, and prepares for adding the interface CMediaPlayer
by making it easier to support new objects with the interface.

Details:

- Generic error handling:
Move some error checks from the object-specific code into the generic
IAndroidConfiguration.c.
Fix bug in SetConfiguration and GetConfiguration where we were not
checking configKey for NULL
Return SL_RESULT_FEATURE_UNSUPPORTED instead of
SL_RESULT_PARAMETER_INVALID if IAConfig interface is exposed on
an object which doesn't really support it (this could if the classes.c
interfaces table was updated before the cases were updated).
Compare with IMuteSolo for non-AudioPlayer.

- Object-specific error handling:
Fix bug where we weren't returning the actual value size in
audioPlayer_getConfig when pValueSize was non-NULL and pConfigValue
was NULL.
Return result SL_RESULT_BUFFER_INSUFFICIENT instead of
SL_RESULT_PARAMETER_INVALID when output buffer is specified
as non-NULL but available space is too small. Compare with
IAudioIODeviceCapabilities.
Return result SL_RESULT_SUCCESS instead of SL_RESULT_PARAMETER_INVALID
when output buffer is specified as NULL; this is intended to allow
the application to discover the required space. Compare with
IAudioIODeviceCapabilities.

- Use 'switch' instead of 'if' for checking object types, to improve
readability when adding more object types

Change-Id: I8b2cdd506a36bfa9b1326a8a9966a6633bbbba6d
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
6d78c9bfb68f8a0db1855bc28c087c39a7eb6f2c 04-Aug-2011 Glenn Kasten <gkasten@google.com> Bug 4603165 playback rate change

Non-trivial implementation is only for AudioTrack with rate range 500
to 2000 per mille and property SL_RATEPROP_NOPITCHCORAUDIO; for Android
MediaPlayer the rate range is 1000 to 1000 per mille.

Details:
- no multi-range
- fix SMP races in GetRate, SetPropertyConstraints, GetProperties
- SetRate only updates mRate if successful
- Rate_SetPropertyConstraints only updates mProperties if successful
- return SL_RESULT_FEATURE_UNSUPPORTED for non-AudioPlayers
which have this interface (currently only MidiPlayer)
- for Android, atomically set playback rate and constraints
and simplify to use hard-coded constraints rather than querying
- per the spec, SetPropertyConstraints now returns
SL_RESULT_PARAMETER_INVALID if the constraints are out of range,
or SL_RESULT_FEATURE_UNSUPPORTED if the constraints are in range but
not supported by this implementation

Change-Id: I051ff92b20f3845ffa12bccec778937d42823e5d
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
5933f3d5e532aaac31ce0e6551c59f0197c0ae3c 29-Jul-2011 Glenn Kasten <gkasten@google.com> Bug 5903270 play interface, events, markers, etc.

As the media framework does not directly support marker and periodic
callbacks, we use a retriggerable one-shot timer at application level
to emulate this. This has the advantage of being faster, but is also
less accurate than if it were in the framework.

Details:
- Get position is now synchronous and (mostly) lock-free
- Fix regression in SL_PLAYEVENT_HEADATMARKER and SL_PLAYEVENTHEADATNEWPOS
- Fix SMP races in GetPlayState, GetCallbackEventsMask, GetMarkerPosition,
GetPositionUpdatePeriod
- AudioSfDecoder was not updating mPositionMsec when getPositionUsec failed
- Updating attributes is relatively expensive, so only do it when a significant change
in SetMarkerPosition, ClearMarkerPosition, SetPositionUpdatePeriod
- Error on unknown message type in onMessageReceived
- Delete an obsolete FIXME
- "Clearing" a marker is now equivalent to disabling the marker event,
and the default marker position is cleared.
- use Android time units and types (int32_t, ANDROID_UNKNOWN_TIME, etc.) where appropriate
instead of SLmillisecond and SL_TIME_UNKNOWN

Change-Id: Ib78bafa20d883b8d927364769663837389b6ea1d
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
99b927751677abfb60a388d65dfeed1fed1db12c 28-Jul-2011 Glenn Kasten <gkasten@google.com> Bug 5080320 MediaPlayer volume

Details:
- re-factor volume-related code yet again
- remove dead variables mAmplFromVolLevel, mAmplFromStereoPos, mDirectLevel
- add placeholders for kEventPrefetchFillLevelUpdate and kEventPrefetchStatusChange

Known issues:
- MPEG-2 TS doesn't yet implement the ability to query channel count, so default to stereo

Change-Id: Ic0f2297b267dc3d380755e8d314e1d5f0f659d7c
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
fa2bd93c3a9852a1f879663eeff598d13cf8fa81 25-Jul-2011 Glenn Kasten <gkasten@google.com> Bug 4599730 fix mute solo, channel count, volume

Change-Id: I1624c744168233c4ef79f2cd3090447b8aa7d53b
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
64621eac543d714d4d3f7cb9c24205f2ddc59201 21-Jul-2011 Glenn Kasten <gkasten@google.com> Bug 5068269 Fix assertion failure after prepare

Change-Id: I890a29eeef9021c7432da8a0ccb409846e107097
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
b2549c73290f1955f3a7731bf98446a45f295dfa 21-Jul-2011 Glenn Kasten <gkasten@google.com> Add more verbose logging

Change-Id: I0cccee0d59fe3eefc6ef94b22bb6100d96bccdff
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
377aa54ce344adcbc8bac731c6db9e7e39b432c5 10-Jul-2011 Glenn Kasten <gkasten@google.com> Defer SL_PLAYEVENT_HEADATEND to avoid deadlock

This is a first example, and if it works well then will
be implemented for other appropriate callbacks also.

Change-Id: Ieeab6b3498c74305e19a9d9c8ff497eff22243aa
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
1a9c2615d0933d183fcb1b9e34ec8f0da2a85153 07-Jul-2011 Glenn Kasten <gkasten@google.com> Rename ANDROID_UNKNOWN_* to UNKNOWN_*

Change-Id: I0d92b7d943690d9af7e08c400471f8b474728bff
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
47550bf6cf5cf08a402a54b1589f4b64582a5120 30-Jun-2011 Glenn Kasten <gkasten@google.com> Bug 4980997 Fix the AudioTrack start deadlock

Details:
- Added AudioTrackProxy, a RefBase proxy for AudioTrack
- Call AudioTrack::start() after unlock

Change-Id: Ib1a05ee57f78432eb4c9d3a5bd68dd31a78d6e3e
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
e6ded5c61944a87fa9e472dec3a6929855d42aeb 28-Jun-2011 Jean-Michel Trivi <jmtrivi@google.com> Fix issues in GenericPlayer destruction

Added a preDestroy() mechanism for the subclasses of
GenericPlayer.
Added a lock around the update and use of the callback
GenericPlayer is using for notifications to the
OpenSL ES framework. This prevents notifications after
the GenericPlayer is flagged for destruction.
Added a lock to protect the update of the audio source
running state, so it doesn't get used after the
AudioSfDecoder is flagged for destruction.
Before stopping the audio source of an AudioSfDecoder
object, release the code buffer if necessary, to
ensure proper teardown of the audio source (OMXCodec)

Change-Id: I6cf08d169a6da622552dda5101dbc61e663ce6aa
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
f4647bf85968ab30eb07f9a80b99177d91068f94 29-Jun-2011 Glenn Kasten <gkasten@google.com> Call AudioTrack start, stop, and pause when needed

These AudioTrack operations are relatively expensive Binder calls (and
will soon be even more expensive to fix a deadlock at AudioTrack::start),
and they were being called excessively. Now AudioTrack start, stop,
and pause are only called when there is an actual play state change.

Details:
- distinguish ATTR_TRANSPORT vs. ATTR_PLAY_STATE for audio players
- android_audioPlayer_setPlayState is only called when the play state changes
- handler_AudioPlayer_transport is only called for transport changes other than play state
- android_audioPlayer_setPlayState is always called with mutex locked
- since media player currently only handles play state, handler_MediaPlayer_transport
is still called for both ATTR_TRANSPORT and ATTR_PLAY_STATE
- since the handlers for ATTR_BQ_ENQUEUE and ATTR_ABQ_ENQUEUE are only called if in
state PLAYING, changed an "if" to an "assert"

Change-Id: Iee2968fd98d215885b7105053bb1604f962ea337
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
6cce136651f6fd2c7aecd45bc553270152d75462 28-Jun-2011 Jean-Michel Trivi <jmtrivi@google.com> Fix race condition when deleting an AudioPlayer

When deleting an AudioPlayer that is used as a PCM decoder,
there can be callback underway, for instance when trying to
delete a player just as the notification of its preparation
arrives.

The fix consists in:
- flagging all callback with the CallbackProtector
mechanism,
- only entering callback when it is valid to do so
- renaming AudioTrackProtector to CallbackProtector
as this mechanism is not exclusively used for the
AudioTrack callbacks.

Change-Id: I9336a75981de43f71a983c1300f3a0ff314ac1e0
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
8bae97ce4243cb9fe37fa35b82cca48fca735e72 23-Jun-2011 Glenn Kasten <gkasten@google.com> Merge "Bug 4606138"
7f5cc1afe49395fefaad9b2bbd728a45d1bfda6a 16-Jun-2011 Jean-Michel Trivi <jmtrivi@google.com> OpenSL ES: additional features when decoding to PCM

Support the following features useful when decoding a compressed
asset to PCM:
- GetDuration in SLPlayItf
- implemented SLMetadataExtractionItf on an AudioPlayer whose
data sink is a buffer queue (i.e. it's a decoder)
- added support for 6 new metadata keys that can be queried
through SLMetadataExtractionItf, which match the fields
of the SLDataFormat_PCM structure.
Updated the decode sample code to use these features: the
slesTestDecodeToBuffQueue app now displays:
- the number of channels
- the channel mask
- the sample size
- the container size
- the sample rate
- the format endianness

Change-Id: I3ca1e29828fd8c16c89da43a28df429c9cdef7af
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
7965455f86c21d6e1f788b284f5fc829e82ff2b5 14-Jun-2011 Glenn Kasten <gkasten@google.com> Bug 4606138

Change-Id: If4745ee39eeedf11388800cc30c26e4c4f8ddaa0
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
a84c5e20d9884d7ec7e4b1377a328c1d1a552b70 02-Jun-2011 Glenn Kasten <gkasten@google.com> Revert "Use AudioTrack::event_type not int in callback"

This reverts commit 1d7ee1569f98f7f1b629a04bb0895165255c7f7b
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
afb606059a28ee6e497e0a8a09a6b66e74a838b6 05-May-2011 Glenn Kasten <gkasten@google.com> Use AudioTrack::event_type not int in callback

Change-Id: Icd60d7eff86e3bdf9907c573b6900c8eca96acf1
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
10a3840407ac3ed61e7873ee7b86d664ccc6149f 11-May-2011 Dima Zavin <dima@android.com> update for new audio.h header location

Change-Id: I2140f1def08bedd8b2bd5170c6ac5edccb80035c
Signed-off-by: Dima Zavin <dima@android.com>
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
ca39f4b4dbeb920a5b97bd65be73f2f7cac77431 06-Apr-2011 Dima Zavin <dima@android.com> system/media: convert to use new defines from hardware/audio.h

Change-Id: I8f0f0d26e10dbbb4dfbc3b52f1c02737a375c5e0
Signed-off-by: Dima Zavin <dima@android.com>
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
a8179ea15c4ff78db589d742b135649f0eda7ef2 13-Apr-2011 Glenn Kasten <gkasten@google.com> Fix build warnings caused by the 'long' change

Change-Id: I34e74d723ae7fd829dd140614928d7880e669f03
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
36b700a829b7a02b873b4cd0cdb0a95342b20a31 11-Apr-2011 Jean-Michel Trivi <jmtrivi@google.com> Use reference to sp on GenericPlayer

When an object like GenericPlayer is stored in CAudioPlayer or
CMediaPlayer by a sp, don't use a pointer to GenericPlayer when
the object is passed as a function parameter, but rather use
a reference to the sp that maintains it.

Change-Id: I49ff219618ac4b657deb43cfffb65f0e0dd6d58d
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
b05ea38e5131001884aa226f90fd50cf594a23f3 06-Apr-2011 Jean-Michel Trivi <jmtrivi@google.com> OpenSL ES / OpenMAX AL code clean up

Do not use cryptic acronyms for Android object type definitions.

Harmonize object state and type naming conventions.

Change-Id: I62bed7aba2e0b9ea0c47264af8e3cf29f74746a8
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
4ee246c55533bdab8ab5fa0f0581744fe58e7c91 29-Mar-2011 Jean-Michel Trivi <jmtrivi@google.com> Move support for SL URI and FD playback under GenericPlayer class

The SfPlayer class was implementing URI and FD decode and playback
in the application process. This CL removes this class entirely
and moves its functionality under the GenericPlayer class. This
means that the playback of URIs and FDs is now implemented through
an android::MediaPlayer object running in the media service.

The SfPlayer header had many StageFright and system includes, which
are now moved to the relevant files where they are required,
instead of automagically coming from sles_allinclusive.h.

Note that this CL breaks support for the following OpenSL ES features
due to missing Android MediaPlayer features:
SLPlayItf.GetPosition
HEADATMARKER
HEADATNEWPOSITION
SLVolumeItf.EnableStereoPosition
SetStereoPosition
SLMuteSoloItf
SLPlaybackRateItf

Support for those features will be reintegrated in subsequent CLs.

Change-Id: I8d7f6ea006eb7b876ef1ca1909d74b4517335850
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
2b06e20ae32388f6e1dfd088d9773c34e6b1cb45 29-Mar-2011 Jean-Michel Trivi <jmtrivi@google.com> Reduce include noise in SL and XA class definitions

In classes.h: we should only have to include the headers
for the objects that are actually stored as member variables of
the OpenSL ES and OpenMAX AL objects (so here AudioTrackProtector,
Effect, and GenericPlayer).
In CMediaPlayer.c: remove useless includes and change the video
surface function prototypes to use const refs to strong pointers
instead of pointers to access the GenericMediaPlayer objects.

Note that android_SfPlayer.h is still in sles_allinclusive.h because
it will be dealt with when the SfPlayer functionality is absorbed
under LocAVPlayer.

Change-Id: Ic2c9459862588399d9545a247cc15341effc0f66
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
83ac345e264c1e22b7a2f1a110b2fe92473394ec 19-Mar-2011 Jean-Michel Trivi <jmtrivi@google.com> Fix bug 4109988 fix deadlock on destroy

Fix deadlock with an AudioPlayer playing from a PCM buffer queue.
This type of player uses an AudioTrack that pulls data through
its callback from a buffer queue.
This issue is that when you destroy the player (whick locks the
object), it tries to destroy the AudioTrack object. The
AudioTrack destructor can only finish when the AudioTrack
callback thread can exit. If a callback was underway when
trying to destroy the object, a race condition existed for
the AudioPlayer lock.
The fix consists in using the "pre-destroy" hook for the AudioPlayer
object. In it, we unlock the AudioPlayer, and block until the
AudioTrack callback has signaled it's done. The pre-destroy
hook also marks the track as "about to be destroyed" so any
callback that gets called once the pre-destroy hook has been
called can return immediately.

Change-Id: I4ca69157ff381232c1edc8fb576c6d9e90c2777f
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
e9236d046fdb5cac0696c42e03443a2439188146 16-Mar-2011 Jean-Michel Trivi <jmtrivi@google.com> Bug 3329759 clean logs, PTS should be unsigned

- Don't pollute logs.
- Save MPEG-2 PTS as an unsigned 64bit value, negative values are
invalid.

Change-Id: I51d427789dd1e42219a63c68159f2e28628f0448
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
37dc2fccf3f122b79ebd554de209d0a3c94ae161 09-Mar-2011 Jean-Michel Trivi <jmtrivi@google.com> Bug 3329759 Implement streamInformation and volume in OpenMAX AL

- Implement StreamInformation for video size notification.
- Implement the XAVolumeItf for volume control
- Fix bug in GUID -> MPH hash.
- Fixed typo in GenericPlayer::pause() log
- Do not signal a discontinuity automatically when the ABQ is
cleared because clearing the queue doesn't imply there will
be a discontinuity in the data (e.g. the same data that was
cleared could be reenqueued)
- In "native-media" test app: add test code to exercise the
XAVolumeItf functionality.

Change-Id: I9f69f8cacbdce51b6d96d60141ec1d0f645df991
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
e7bfcdc183454ec959ff51342f0973cabba219b2 08-Mar-2011 Jean-Michel Trivi <jmtrivi@google.com> Bug 3329759 Implement Clear() and GetState() for MPEG-2 TS

- implemented Clear() in AndroidBufferQueue
- declared and implemented GetState() in AndroidBufferQueue
- fixed typo in AudioPlayer_to_android.cpp that cause a "case"
to be compiled as a label (no unused label warning from
compiler)
- more test in sandbox/streamSource

Change-Id: If4eede16430cda943224bf950669cc105ac2f894
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
70c49ae2867094072a4365423417ea452bf82231 07-Mar-2011 Jean-Michel Trivi <jmtrivi@google.com> Bug 3329759 support commands in SLAndroidBufferQueueItf

Support for EOS, DISCONTINUITY, and DISCONTINUITY with
a PTS.

- in IAndroidBufferQueue structure, added buffer type
- modified AdvancedBufferHeader structure to have a buffer
type-specific structure that contains all the items for each
buffer
- added parsing of items when enqueueing a buffer
- enforce buffer size enqueue to be a multiple of MPEG-2 TS
block size for buffer of the corresponding types
- when enqueueing a buffer on an empty queue, implemented
an asynchronous notification on StreamPlayer to consume
the newly queued buffer. Verified this kicks off playback
after having starved the framework for buffers.
- report unknown duration when using AndroidBufferQueue

Change-Id: I9bde97a6c6ffca7d376b4963313b820b35f50a26
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
d158d31a6bbb06426b71c3d097b7768bc3fb79a3 04-Mar-2011 Jean-Michel Trivi <jmtrivi@google.com> Bug 3329759 TS streaming over SLAndroidBufferQueueItf

Modify the SLAndroidBufferQueueItf interface to offer a model
where buffers of data can be queued along with commands
(messages) when used for playback, or buffers of data can be
received along with metadata (messages)

changes:
- new callback and enqueue functions in SLAndroidBufferQueueItf
and XAAndroidBufferQueueItf.
- definition of a new struct, AdvancedBufferHeader, for
the buffers in the queue.
- decoupling of the "buffer available to be filled" from SF
and the call to the ABQ callback. Implemented in new
file AndroidBufferQueueSource.cpp
- source/sink checks and memory allocation when creating an
AudioPlayer or MediaPlayer that uses SLAndroidBufferQueueItf,
and verifying the data fed to the ABQ is declared as
SL_CONTAINERTYPE_MPEG_TS
- updated tests/native-media XA demo code, and
tests/sandbox/streamSource to use the new interface.

Change-Id: I48e44f346e718041d835fde51e349923fcc1f4b1
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
68d56b8ebaf60184a3aef988e3d2b09ed8b88c05 24-Feb-2011 Jean-Michel Trivi <jmtrivi@google.com> OpenMAX AL: consolidate MediaPlayer implementations under superclass

The OpenMAX AL MediaPlayer object has two implementations: one
for playing from URI/FD (LocAVPlayer) and one for playing from
AndroidBufferQueue (StreamPlayer). They both inherit from AVPlayer.
This CL makes LocAVPlayer and StreamPlayer inherit from
GenericMediaPlayer (new name of AVPlayer) which encapsulates the
interaction with an android::MediaPlayer instance running in
the media server process.
Also it makes GenericMediaPlayer inherit from GenericPlayer, the
player superclass also used in OpenSL ES.

After this CL, the OpenMAX AL and OpenSL ES have a common class
hierarchy for their players.

Change-Id: I5f6e279fc29b7f6f26c9ed5c83a9455cfda88ff4
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
13837cf3f7be0eb8b1a9552bd99a89f98c987720 01-Feb-2011 Jean-Michel Trivi <jmtrivi@google.com> OpenSL ES: support decode to PCM buffer queue

Created a new audio player class, APlayer, from which we derive
subclasses to encapsulate OpenSL ES AudioPlayer implementations:
- ASfPlayer derives from APlayer and encapsulates StageFright
functionality for audio decoding to a buffer
- ADecoder derives from ASfPlayer and encapsulates rendering
the decoded audio data to a callback function. It interfaces
with the OpenSL ES Buffer Queue interface to pass the decoded
data back to an OpenSL ES application.

For OpenSL ES, to support decoding to a Buffer Queue, we now
allow an AudioPlayer to have its sink be a PCM buffer queue.

Change-Id: I9aefeb0375a71f7ca770c5c62b4fb8faf59c9c23
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
b2aeb0f1009555181dabb944fe05901cb6e6f632 12-Jan-2011 Jean-Michel Trivi <jmtrivi@google.com> More file renames and header inclusion reorder

More file renames and include reordering to separate Android
classes, and the mapping of the C OpenSL ES and OpenMAX AL
function calls to the Android implementation.

Change-Id: Id6f63af80bd581ed9cab495e2c11a86589ecf6c9
/frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp