History log of /system/media/wilhelm/src/android/android_AudioSfDecoder.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
94d351603f83fdaa0c2bb5df7911c3e61fab01e2 08-Nov-2011 Jean-Michel Trivi <jmtrivi@google.com> Bug 5585323 Authorize audio decode for system

Authorize the use of specific audio codecs for audio decoding
by the system, which guarantees audio is decoded for playback,
when the appropriate system permission is used.

Change-Id: I0633b04b4d0aebe89804ef48752bf05d72abc56d
/system/media/wilhelm/src/android/android_AudioSfDecoder.cpp
762f10659c2ac6fb66afd09be5bddd7ffebbf9df 01-Nov-2011 Jean-Michel Trivi <jmtrivi@google.com> am c157a9c2: Bug 5544082 Filter out unsupported codecs in OpenSL ES

* commit 'c157a9c259474d4e1736c4f9ccccad10b5000734':
Bug 5544082 Filter out unsupported codecs in OpenSL ES
c157a9c259474d4e1736c4f9ccccad10b5000734 01-Nov-2011 Jean-Michel Trivi <jmtrivi@google.com> Bug 5544082 Filter out unsupported codecs in OpenSL ES

When decoding compressed audio data, disregard tracks
encoded with unsupported codecs.

Change-Id: If0535013990923c6859829106ccf9e92e5856f90
/system/media/wilhelm/src/android/android_AudioSfDecoder.cpp
891673f650f233f17f60e2c663fa24279b8dc9af 30-Sep-2011 Glenn Kasten <gkasten@google.com> Fix race in getting duration

mDuration is protected by mSettingsLock because it is accessed from both
the ALooper thread and from the application thread, but only one of the
two "set"s was using the lock, and the "get" was not using the lock.

Also added some comments about the lock, and moved lock closer inside { }.

Change-Id: I7c96186f31baaad1b941d934549cb50d4f82d0c8
/system/media/wilhelm/src/android/android_AudioSfDecoder.cpp
810d56b4cf6c5893b48e7d56166bb18635052dec 11-Oct-2011 Glenn Kasten <gkasten@google.com> Merge "Multithread safety and code reduction"
e851581e7a62192f69626b9a0d2e5380a4d3979c 30-Sep-2011 Glenn Kasten <gkasten@google.com> Multithread safety and code reduction

Remove unsafe GenericPlayer::getSampleRate(). getSampleRate() was not
thread-safe as it accessed a member variable updated in the looper thread
without a lock. If getSampleRate() is ever needed again, the sample rate
is available in the mPcmFormatValues array, which does have a lock.

Replace member variables mChannelMask, mChannelCount, and mSampleRateHz
by local variables for locality and performance.

Change-Id: Ibf92ed090430153d748ded4d0b835e429df47eea
/system/media/wilhelm/src/android/android_AudioSfDecoder.cpp
456ab720f41efee12ca572475fbe3ade530b5aa0 04-Oct-2011 Glenn Kasten <gkasten@google.com> Bug 5406664 workaround GetPosition for decode

Change-Id: I6158108a8ca192f704558caca2006bf704c80d6e
/system/media/wilhelm/src/android/android_AudioSfDecoder.cpp
563ba31c5b77092d3d2672a3ee89f1eaeed1aeb5 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
/system/media/wilhelm/src/android/android_AudioSfDecoder.cpp
becfe88080f47bce3206836abf738ffddeb5cc47 15-Sep-2011 Glenn Kasten <gkasten@google.com> Bug 5263052 play events for decoder use case

This version should be more resilient to decode time vs. real time.

Miscellaneous:
- comment about GetPosition accuracy
- remove unused AudioSfDecoder::onRender implementation

Change-Id: I16a7726e0b1459ed1421fe50cb4d683d5c3bdd6b
/system/media/wilhelm/src/android/android_AudioSfDecoder.cpp
c1e8c412b55b43695d527607036fd47016610f21 07-Sep-2011 Glenn Kasten <gkasten@google.com> Merge "Bug 5262776 reliability of play event callbacks"
332b3a2a95b76ea90ce23be0b48403a9dd88c1b3 03-Sep-2011 Glenn Kasten <gkasten@google.com> Bug 5262776 reliability of play event callbacks

This makes HEADMOVING and HEADATMARKER work more reliably, especially
at the beginning of track and under heavy load. Previously if an event
update was missed because update period is too small or mediaserver/client
is too busy to keep up with notifications, then subsequent events
were lost. This happened more than you might expect; the first event
was often lost and things just got worse from there.

Cleanup in AudioSfDecoder:
- Call up to superclass (GenericPlayer) onSeek and onLoop
to make future maintenance easier.
- Delete dead code in onMessageReceived.
- Logic depends on mLastDecodedPositionUs not being ANDROID_UNKNOWN_TIME
- Simplify getPositionUsec

Add more logging in GenericPlayer::updateOneShot.

Change-Id: Iacddafeb3a20b25bee6da602f6a783201d80be10
/system/media/wilhelm/src/android/android_AudioSfDecoder.cpp
22aa5a56dcdfb4c2521f4064e98111d3a739782f 01-Sep-2011 Glenn Kasten <gkasten@google.com> Bug 5244675 PCM sample rate metadata units

The current metadata key macro name ANDROID_KEY_INDEX_PCMFORMAT_SAMPLESPERSEC
is confusing. This change renames it to ANDROID_KEY_INDEX_PCMFORMAT_SAMPLERATE,
and documents that it is in Hz rather than milliHz. The key string is
renamed from AndroidPcmFormatSamplesPerSec to AndroidPcmFormatSampleRate.

Details:

OpenSL ES 1.0.1 PCM struct SLDataFormat_PCM field samplesPerSec
[sic] is in milliHz. OpenSL ES 1.1 preserves that struct, but adds
struct SLDataFormat_PCM with field sampleRate also in milliHz. If the
ANDROID_KEY_INDEX_PCMFORMAT_* metadata keys were intended to exactly
model the OpenSL ES PCM data format struct, the metadata sample rate
would also be in milliHz units. However, the rest of Android operates
in Hz so we use Hz here also.

Backwards compatibility for the name should not be an issue,
as the initial beta developer has not yet started using this metadata.

Related change: delete a duplicate header file.

Change-Id: Ib8f620dfe7a328f621ddbb19f55e5691eb22d7b5
/system/media/wilhelm/src/android/android_AudioSfDecoder.cpp
9923b038db25831fdb481e73e90374f57fd4c871 31-Aug-2011 Glenn Kasten <gkasten@google.com> Bug 5244675 default channel mask based on count

Change-Id: Ica0b1bd5a23d9bbc318003509e2463a588d9bd39
/system/media/wilhelm/src/android/android_AudioSfDecoder.cpp
bf02afef1224b349d396d34c7a97bc5dd7e97f37 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
/system/media/wilhelm/src/android/android_AudioSfDecoder.cpp
d62f504ebe6a3f9b15c6115f9add1c4fed87d847 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
/system/media/wilhelm/src/android/android_AudioSfDecoder.cpp
333c2341445e9f161ff022a4b7d5f69e9e149b60 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
/system/media/wilhelm/src/android/android_AudioSfDecoder.cpp
a81ac67d31590942f5a3a8233cf9759c20a494dc 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
/system/media/wilhelm/src/android/android_AudioSfDecoder.cpp
49cfc9858d3a610b52e3e6b2fc1733888f7743f5 27-Jul-2011 Glenn Kasten <gkasten@google.com> Bug 5082191 fix slesTest_decodeToBuffQueue assert

Change-Id: I2ec181cc7eba000847bd28e6d04733d3496d74d9
/system/media/wilhelm/src/android/android_AudioSfDecoder.cpp
7a114799472e645dbd4061ff5bed793fd6d8e84f 27-Jul-2011 Jean-Michel Trivi <jmtrivi@google.com> Report last decoded position as AudioPlayer position for PCM decode

Change-Id: I1ec413137d549235af4dc66cb033e1cd0bbbad62
/system/media/wilhelm/src/android/android_AudioSfDecoder.cpp
347285f59e4aa7a062f67c4ae3a854cbdacb6378 20-Jul-2011 Jean-Michel Trivi <jmtrivi@google.com> Fix bug 5049371 Metadata for decode to PCM buffer queue

When decoding a URI or FD with OpenSL ES to a PCM buffer queue,
you cannot rely on the information given by the extractor, or
the OMXCodec before the latter has decoded one buffer.

The fix consists in two parts:
1/ where to retrieve the PCM format from:
the information first retrieved from the extractor if available,
but then overwritten by the OMXCodec values as soon as it
issues INFO_FORMAT_CHANGED
2/ when can the application retrieve the information:
the information is available when the first buffer of decoded
data is returned to the application via the buffer queue
callback. The test app is updated to reflect this, and verify
that the query can safely happen during the callback.

Change-Id: Ic034c7ff9412c94e9df2aaa3c1d61e9d3bf507d9
/system/media/wilhelm/src/android/android_AudioSfDecoder.cpp
463a7641944e4a3613f5d76aa8450070ef56b9ff 07-Jul-2011 Glenn Kasten <gkasten@google.com> Rename ANDROID_UNKNOWN_* to UNKNOWN_*

Change-Id: I0d92b7d943690d9af7e08c400471f8b474728bff
/system/media/wilhelm/src/android/android_AudioSfDecoder.cpp
56d72f3683268937c92786b35532729e1e54cf80 07-Jul-2011 Jean-Michel Trivi <jmtrivi@google.com> Fix metadata value size check

A bug was introduced during the review of the SLMetadataExtractionItf
interface implementation where the value size was improperly
compared against the size given by the application.

Change-Id: Iae1359e84a410e3fec53bd65e0fba9cc97fce08a
/system/media/wilhelm/src/android/android_AudioSfDecoder.cpp
1209c173a13a62d0f7d9f1d605e3665a5818fa90 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
/system/media/wilhelm/src/android/android_AudioSfDecoder.cpp
5afa50bca331f7ac29002f97421abf276919f2d6 25-Jun-2011 Jean-Michel Trivi <jmtrivi@google.com> Fix NPE in audio decoding

If the data source wasn't properly initialized, the corresponding
member field should be accessed.

Change-Id: I811827991078db4b8dc4278014f046361f06e1a2
/system/media/wilhelm/src/android/android_AudioSfDecoder.cpp
be91f6328a084475e1cf58b54b8b732e088940b5 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
/system/media/wilhelm/src/android/android_AudioSfDecoder.cpp
4639bda67e9b7b93d87c42c3321787dd45df0f0d 03-Jun-2011 Jean-Michel Trivi <jmtrivi@google.com> Stop the OMX codec when destroying the OpenSL ES decoder

The AudioSfDecoder class uses a MediaSource interface from
an OMXCodec object. In the class destructor, the codec must
be stopped before the codec is anihilated.

Change-Id: Ibf0d729e055dcd8f4e05f3fb8332d650f9be0d30
/system/media/wilhelm/src/android/android_AudioSfDecoder.cpp
8ad101d5bcaca289da3d820e2b87b5da55e560f9 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
/system/media/wilhelm/src/android/android_AudioSfDecoder.cpp
d004feb25e830dd92a8d6e6af0d363e4d11721a2 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
/system/media/wilhelm/src/android/android_AudioSfDecoder.cpp
30ebe675beff91283cc72d4ee5e94e56ab7e107f 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
/system/media/wilhelm/src/android/android_AudioSfDecoder.cpp
fcc996296bdbf6c3949ad4312991fdde4ae2e157 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
/system/media/wilhelm/src/android/android_AudioSfDecoder.cpp
40c08fcbfac815da96c2db0a0586fd5b12bc0a5f 14-Feb-2011 Jean-Michel Trivi <jmtrivi@google.com> Report an error when the data source can't be created.

Check the value returned by DataSource::CreateFromURI(uri)

Change-Id: Ia94b18b09c68d1e8bf90d2f1a099319d5f5e565e
/system/media/wilhelm/src/android/android_AudioSfDecoder.cpp
dff1b1fc1f687c544e19df56bef225c45f7256a9 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
/system/media/wilhelm/src/android/android_AudioSfDecoder.cpp