History log of /frameworks/wilhelm/src/android/AudioPlayer_to_android.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
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